Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

ตรวจสอบความเข้ากันได้ของแท็ก HTML5 <mark> กับ jQuery

ใช้โค้ดต่อไปนี้ตรวจสอบความเข้ากันได้ของแท็ก HTML5 <mark>:

var $myEL = $('');
$myEL.appendTo('body');
var bgColor = $myEL.css('backgroundColor');
if (/rgb\(255\, 255\, 0\)/.test(bgColor))
  return true;
else
  return false;