Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下 jQuery 代码:
var fnVal = $(_placeHolder[0].parentElement.children[0]).attr('onclick');
在调试时我可以看到fnValas
fnVal
function onclick(event) { javascript:DisplayData($('#divexpand')[0],'true'); }
我希望将功能替换true为.DisplayDatafalse
true
DisplayData
false
我怎样才能做到这一点?
只需为其分配一个新函数,它将替换旧函数(在此也不需要 jQuery):
_placeHolder[0].parentElement.children[0]).onclick = function() { DisplayData(document.getElementById('divexpand'),'false'); };