I want to delete the element's click when I click (I am using But when I remove, I can not reconnect it again. This only incident again! This is what I am trying to do: I am using Set Interval () to see whether the element has not been clicked. If it is not, then it can be used again (). I also tried to remove the event handler in the browser console: But when I try to reconnect the event handler ... This does not work, and will not repeat the behavior. off (<) Code> for this), and when the element is not clicked (click 'active') you want to add it again. This is not clicked to indicate, I am using a class called 'disabled'.
$ ('.my-element'). ('Click', function () {$ ('.my-element'). Off ('click');}); Var disabled = setInterval (function () (if ($ ('.my-element'). Haclass ('no-click')) {$ ('my-element'). On ();}}, 1000) ;
$ ('my element') closed () .;
$ ('.my-element'). On ();
at
and off
without any parameters There is no effect, ideally you should name the event and it is a handler for those methods.
var handler = function () {// ...} $ ('.my-element'). ('Click.namespace', handler); // ... $ ('my-element'). Off ('click.namespace', handler);
If the handler should be called only once, you may also consider using the a
method besides setIntevarl
Using a bad idea, you should force the handler after adding the class. In this case, I recommend using Event Deployment Technology:
$ ('# aStaticParent'). ('Click', '.my-element.not-clicked', function () {// handler is called only when element 'not clicked' classname $ (this) .removeClass ('not clicked went');});
Comments
Post a Comment