作者:热情连心锁426 | 来源:互联网 | 2023-09-02 14:33
attr()方法设置或返回被选元素的属性值。removeAttr()方法从被选元素中移除属性。这里起先没有明白写成了$(#doctorbtn).attr(onclick)&
attr() 方法设置或返回被选元素的属性值。
removeAttr() 方法从被选元素中移除属性。
//这里起先没有明白写成了$("#doctorbtn").attr("onclick"),添加不了事件
//sendMessageDOCTOR();添加的事件函数名
$("#doctorbtn").attr("onclick","sendMessageDOCTOR();")
//这里移除事件
$('#doctorbtn').removeAttr('onclick');
我是小白,希望帮助更多的小白