亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Recently, when processing business logic, I unbind the same element first and then bind again, and found a usage problem.
某草草
某草草 2017-06-26 10:58:53
0
2
1019

After unbinding first, bind sometimes fails. Some business requirements no longer need to be bound, and some need to be re-bound.
The following is a simple example

window.onload=function(){
   $("input").unbind();
}            
$("input").bind("click",function(){
   alert("1");
})

This cannot be rebinded

Written like this, you can bind

        $("input").unbind();
        $("input").bind("click",function(){
            alert("1");
        })

Ask the reason for this problem? Expert analysis

某草草
某草草

reply all(2)
洪濤

The execution order is different. The unbind in onload is executed after the bind below, so you bind first, then unbind after onload

伊謝爾倫

You bound a click event to the input, but the click event was removed from your window.onload

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template