How to use unbind and bind event in javascript

  By Junaid A   Posted on May-18-2018   533

.Net

How to use  unbind and bind event in javascript

 

1. bind()

 

$("#BoxId").bind("click", (function () {

$('span').text("Single Clicked");

}));

 

2. unbind()

Unbind or detached the existing events is quite easy, just need to specified the attached event type.

 

Detached the “click” and “dblclick” event from elements with an Id of “BoxId”.

 

$('#BoxId').unbind("click");

$('#BoxId').unbind("dblclick");

 

 

 

bind unbind same time

 

 

for form  submit

 

 $("#CrudRateTierItem").unbind("submit").bind("submit", function (e) { });

 

 

for button cick

 

 

 $("#CrudRateTierItem").unbind("click").bind("click", function (e) { });

Avantages:

it will disable multiple clicks and multiple form submission

How to use  unbind and bind event in javascript

 

1. bind()

 

$("#BoxId").bind("click", (function () {

$('span').text("Single Clicked");

}));

 

2. unbind()

Unbind or detached the existing events is quite easy, just need to specified the attached event type.

 

Detached the “click” and “dblclick” event from elements with an Id of “BoxId”.

 

$('#BoxId').unbind("click");

$('#BoxId').unbind("dblclick");

 

 

 

bind unbind same time

 

 

for form  submit

 

 $("#CrudRateTierItem").unbind("submit").bind("submit", function (e) { });

 

 

for button cick

 

 

 $("#CrudRateTierItem").unbind("click").bind("click", function (e) { });

Avantages:

it will disable multiple clicks and multiple form submission

By  asifjans    18-May-2018 Views  533



You may also read following recent Post

Recent Column What are 3 C
192  By
Recent Column what is .net
418  By