I anchor a drop down list
("#dropdownlist").change(function(){ //Do stuff });
The above code is called many times.
How can I cancel this event before binding it every time?
You can use the method unbind():
unbind()
$('#dropdownlist').unbind('change');
You can use one instead of bind:
("#dropdownlist").one('change',function(){});
:
var f = function () { } $('#xx').bind('change', f); // for bind function f $('#xx').unbind('change', f); // for unbind unbind function f
, jQuery .
, , , .
$("#foo").bind("change.validation", doValidation() );
$("#foo").bind("change.helptext", toggleHelptext() );
, .
$("#foo").unbind("change.validation"); $("#foo").bind("change.validation", doValidation() );
Alex
Source: https://habr.com/ru/post/1719086/More articles:disable java log rotation - javaGit настройка instaweb httpd для использования apache2 на сервере OSX Leopard - gitDrupal 6 absolute wildcards in _menu (), is this possible? - drupalWhy doesn't it embed a method that is explicitly equivalent to a declaration? - c #Как изменить тег, чтобы я мог выбрать изображение в CSS? - htmlReading CSS files in .NET. - cssFriend's class and all its descendants - c ++C ++ laws? (similar to the Law of the Big Three) - c ++Apache slabs convert open tag and close tag without content to empty tag - javaKeyError with dict.fromkeys () and dict-like object - pythonAll Articles