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

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.

主站蜘蛛池模板: 阳信县| 大冶市| 宜城市| 安国市| 临邑县| 东至县| 延津县| 晋江市| 五大连池市| 沅江市| 错那县| 兴业县| 德兴市| 枞阳县| 亳州市| 关岭| 皮山县| 靖西县| 赤城县| 拜城县| 章丘市| 西贡区| 甘洛县| 庆安县| 平乐县| 丹阳市| 贡觉县| 乾安县| 克山县| 武汉市| 九龙县| 怀来县| 徐州市| 张家界市| 井陉县| 凤台县| 宜丰县| 道孚县| 宾川县| 石屏县| 忻城县|