unbind

How can I unbind(remove) angular models when not in DOM

混江龙づ霸主 提交于 2019-12-25 01:47:00
问题 Here is a simple demonstration of what I'm struggling to achieve. <div ng-controller="MyCtrl"> <input type="button" ng-click="a=!a" value="toggle a"/> <div ng-if="a"> <input type="text" ng-model="del.a1" />{{del}} </div> <input type="text" ng-model="del.a2" /> {{del}} </div> Initially the value of del is {} and ng-if is false the property a1 is under ng-if condition. Test Case : step 1 : toggle the ng-if to true so that a1 is visible step 2 : enter some value into a1 (you can anytime enter

jquery rebind() disable events for a specific time, then rebind them

半世苍凉 提交于 2019-12-24 07:05:34
问题 After click on a button my script loads new content. As long as it is loading I don't want a list of elements to be clickable. IS there any way to unbind the click-event of those elements, load the content and then "rebind" the events correctly? What I want to prevent is a if-statement inside every click-function/element. Here is what i've tried: $(load_button).click(function(){ $('a').each(function(){ var dis_e = $(this).data('events'); $(this).data('disabled-events', dis_e); }).unbind(

What can make jQuery's unbind function not work as expected?

為{幸葍}努か 提交于 2019-12-24 01:01:48
问题 Have a look at the following code (additionally, you will need jquery.js, jquery.viewport.js and jquery.scrollTo.js). The behaviour I would expect from this script is that whenever I scroll the page, the red rows ( <tr> elements with class alwaysVisible ) should be inserted just underneath the top-most visible row ( <tr> element) of that table. Then, the page should be scrolled so that the first of these red rows appears "exactly" at the top of the viewport. What actually happens is that

How to unbind a specific event handler

放肆的年华 提交于 2019-12-17 09:08:10
问题 Code: $('#Inputfield').keyup(function(e) { if(e.which == 13) { functionXyz(); } else { functionZyx(); } }); $(document).keyup(function(exit) { if (exit.keyCode == 27) { functionZzy(); } }); Question: How to remove the keyup event handler of keyCode == 27 and keep the other $(document).keyup event handlers intact? 回答1: You have to use a named function so you can reference that specific handler when calling .unbind(), like this: function keyUpFunc(e) { if (e.keyCode == 27) { functionZzy(); } }

click event fires multiple times issue, how to?

只愿长相守 提交于 2019-12-13 16:05:25
问题 I have a button. when I click it I am appending some buttons to the DOM. The issue I have is that those buttons that I am appending fire multiple times. $(el).on('click', function (e) { key(); }); function key() { $(document).on('click', '#key li', function () { console.log($(this)); }); } First time key() is called, the console.log fires once The second time I call key() the console.log fires twice And so on I've tried adding $(document).find('#key li').unbind('click') , but that doesn't

jQuery unbind('hover') does not work [duplicate]

跟風遠走 提交于 2019-12-12 10:36:51
问题 This question already has answers here : How do I unbind “hover” in jQuery? (8 answers) Closed 4 years ago . My unbind does not work. $("img.hoverable").hover(ChangeImage, ChangeBack); $("a img.hoverable").unbind('hover'); The HTML could be like this <img class="hoverable" src="something.jpg"/> <a href="#"><img class="hoverable" src="something.jpg"/></a> When I hover over the second HTML, ChangeImage is still fired. I am not sure if I am using it correctly, can anyone please advise? 回答1: Try

Jquery, unbinding mousewheel event, then rebinding it after actions are completed?

a 夏天 提交于 2019-12-12 08:45:41
问题 I've been struggling with this for a little while now.. I am using this code to monitor the mousewheel so it can be used for scrolling with a slider that I have.. however, it has an issue where the actions queue up so if you scroll with the mousewheel fast (like anyone would do normally) they build up and it causes buggy behavior.. I know about handling this sort of issue with animation, but not with a mousewheel monitor.. I want to do something like unbind the mousewheel at the start of the

jQuery “unbind” back to “bind” not working

可紊 提交于 2019-12-12 02:18:11
问题 When I click an element I would like to unbind "mouseenter" and "mouseleave" events which works fine, but I would like to bind them back on if another element is clicked - this does not work. any help? here's the code: <script type="text/javascript"> $(document).ready(function(){ $("#shape1 img").click(function(){ $("#shape1 img,#shape2 img, #shape3 img, #shape4 img, #shape5 img").unbind('mouseenter mouseleave'); }); $("#close").click(function(){ $("#shape1 img,#shape2 img, #shape3 img,

Modal unbind on fade

荒凉一梦 提交于 2019-12-11 19:24:32
问题 This is version of a previously asked question (Modal windows and binding/unbinding). I have a form and when "Add New" is selected a modal window appears in which text can be typed in a field to add to the dropdown. This can happen for 8 or 9 fields. The bug is that if the user dismisses the modal by clicking either on the "X" or on the dark space around the box and then selected "Add New" again and clicks the "Add" button, the modal is still bound to the event (I guess) and so there is a

how to properly unbind events in Jquery-Mobile using on/off when a page is kept in the DOM?

人盡茶涼 提交于 2019-12-11 04:56:21
问题 As Jquery Mobile keeps some pages in the DOM when navigating around, a page may be visited multiple times when going back and forth. If I'm binding to a page like below and inside this binding perform all my page logic, which includes "nested element bindings": // listener for the page to show: $(document).on('pagebeforeshow.register', '#register', function() { // stuff // page event bindings: $(document).on('click.register', '.registerSubmitter', function(e) { // do something }); }); Going