官术网_书友最值得收藏!

Solution #5 - disable the button

A similar idea: instead of removing the event handler, disable the button, so the user won't be able to click. You might have a function like the following:

function billTheUser(some, sales, data) {
document.getElementById("billButton").setAttribute("disabled", "true");
window.alert("Billing the user...");
// actually bill the user
}

This also works, but we still have objections as for the previous solutions (coupling the code to the button, need to re-enable the button, harder testing), so we don't like this solution either.

主站蜘蛛池模板: 青河县| 沿河| 乌拉特前旗| 育儿| 卓尼县| 哈密市| 嘉义县| 江西省| 交口县| 皮山县| 万年县| 若羌县| 方城县| 海淀区| 甘泉县| 类乌齐县| 浦县| 黄大仙区| 苍南县| 始兴县| 泰和县| 凤翔县| 大理市| 兰考县| 南京市| 灵山县| 濉溪县| 张掖市| 营口市| 卢氏县| 德阳市| 澳门| 五大连池市| 旬邑县| 庐江县| 沁阳市| 年辖:市辖区| 安吉县| 远安县| 冷水江市| 甘肃省|