在我的JS obj.attr('...')和obj.prop('...')不起作用,但obj.getAttribute('...')运作良好.
你能告诉我为什么吗?
function ShowTips(obj) // show tip in element's attribute
{
var msg = obj.attr("tip"); // failed.
alert(msg);
}
function startPoint() // start from here.
{
var obj = document.getElementById("img01");
ShowTips(obj);
}
Run Code Online (Sandbox Code Playgroud)