我們如何編輯下面的代碼以將此功能綁定到myLink
和myButton
。將JQuery綁定到多個對象的功能
if (section === x) {
myButton = $("#a");
myLink = $("#b");
} else {
myButton = $("#c");
myLink = $("#d");
}
myLink.click(function(e) {
e.preventDefault();
showMyDialog();
});