Questions tagged [unbind]

Remove a previously-attached binding to an IP address:port pair, naming context, event handler, communication channel, or other system object. See [tag:bind] for a partial list of the common uses of the bind/unbind concept.

360 questions
2
votes
1 answer

Unbind/bind vs. delegate in jQuery: Which is the best solution?

I have jQuery code that handles unbinding and binding event handlers to elements that are dynamically added to the page. The code has a wrapper function that unbinds existing handlers from elements with a given id prefix, and then binds the event…
Carvell Fenton
  • 2,341
  • 6
  • 23
  • 30
2
votes
3 answers

bind and unbind problem for secondly click

There are my codes: Jquery $(function() { $("#evtTarget").bind("mouseover",highlighted); $("#evtTarget").bind("mouseleave",highlighted); $("#evtTarget").bind("click",function(){ …
Programmer
  • 157
  • 2
  • 3
  • 11
2
votes
4 answers

javascript unbind dom events

I'm working on a web framework and am trying to build XSS prevention into it. I have set it up so it will escape incoming data for storage in the database, but sometimes you want to save html that the user generates. I am trying to make a custom tag…
regality
  • 6,496
  • 6
  • 29
  • 26
2
votes
3 answers

Jquery rebind click after unbinding

I've got an element inside a div which has a click event associated to it. Both click events work fine, except they both fire at the same time. When I click on the inner element to disable the parent div's click event: My html (inside a @foreach MVC…
LanFeusT
  • 2,392
  • 5
  • 38
  • 53
2
votes
2 answers

jQuery click event - first click makes ajax call, following clicks toggle

I have an anchor that when clicked makes an ajax call to load some html into a div and then load a script. I want to unbind that event after the first click, and replace it with another click event that toggles between showing and hiding that div. …
user883036
  • 113
  • 1
  • 1
  • 6
2
votes
5 answers

jQuery question on unbind

Can i use jQuery unbind() with live() e.g. $(".content_media").unbind("touchstart").live("touchstart",function(){....}); If yes, what exactly does it mean? Basically I want to understand what does an unbind mean I have a page where I bind elements…
copenndthagen
  • 49,230
  • 102
  • 290
  • 442
2
votes
3 answers

how to rebind click event to anchor after unbind?

I want to unbind the anchor after the first click, but when user click a specific button, I want to rebind the click event to this anchor I wrote this code $(document).ready(function(){ $("a.package").click(function(){ //alert('click');…
sahar
  • 569
  • 7
  • 16
  • 29
2
votes
1 answer

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

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 ( elements with class…
Shawn
  • 10,931
  • 18
  • 81
  • 126
2
votes
2 answers

Bind & Unbind... how to bind again when this function finished?

http://jsfiddle.net/3NRsd/ var foo = $("div").bind("click", function() { $("div").animate({"height" : "500px"}, 2000); $("div").animate({"height" : "50px"}, 2000); $("div").unbind(); });
l2aelba
  • 21,591
  • 22
  • 102
  • 138
2
votes
2 answers

bind / unbind on timer not working in jquery. Will unbind but reactivating button fails

I have written some jquery in which I would like after the user clicks a button it deactivates for the duration of the animation then activates again. I have tried using call backs from the animation and now timers but I cannot get the function to…
2
votes
1 answer

jQuery's (ui) general approach to unbinding events?

It's a small question yet important. Should I run .unbind('click') before doing e.g. button.click(... ? Basically, if there's an event defined for a control, am I supposed to unattach it before attaching it again? I know this is the case for those…
IamDeveloper
  • 5,156
  • 6
  • 34
  • 50
2
votes
2 answers

Cannot unbind event bound to $(document)

I have event handler bound to every element of the page via $(document).bind(). Does anybody know how to unbind this handler for particular element? Here is my sample code that doesn't work the way I want: