html()和innerHTML使用区别
一、html()
html() 方法设置或返回被选元素的内容。
当该方法用于返回内容时,则返回第一个匹配元素的内容。
当该方法用于设置内容时,则重写所有匹配元素的内容。
返回内容:
$(selector).html()
设置content内容:
$(selector).html(content)
使用函数设置内容:
$(selector).html(function*(index,currentcontent)*)
jQuery写法 $(’#test’).html()
$("button").click(function()