[jQuery] Re: Disable a link temporarily
Thank you for the replies. I like the toggle idea. It's simple and it works. Cheers, Rob. On Feb 7, 11:35 am, donb falconwatc...@comcast.net wrote: Rather than bindin/unbinding events, why not put a hidden label (or tag of your choice) there with the same text, then toggle between them: $(a, label).toggle(); Show the anchor or show the label. On Feb 7, 6:07 am, jQuery Lover ilovejqu...@gmail.com wrote: $('a.show_reset_pass_box').unbind('click'); This line is unbinding ALL click events. So the second click binding function is not fired, since it's not bound... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:48 PM,rob303rob.cub...@googlemail.com wrote: Hi, This should be easy. I want to disable a link and then re-enable it later. I have: $('a.show_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').unbind('click'); return false; }); Which works just fine. But then when I try to do: $('a.close_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').bind('click'); return false; }); The click event isn't bound back onto the anchor. The anchor looks like this: a class=show_reset_pass_box title=Lost Password?Lost Password?/ a What am I doing wrong? Many thanks in advance for any hekp. Rob.
[jQuery] Re: Disable a link temporarily
$('a.show_reset_pass_box').unbind('click'); This line is unbinding ALL click events. So the second click binding function is not fired, since it's not bound... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:48 PM, rob303 rob.cub...@googlemail.com wrote: Hi, This should be easy. I want to disable a link and then re-enable it later. I have: $('a.show_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').unbind('click'); return false; }); Which works just fine. But then when I try to do: $('a.close_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').bind('click'); return false; }); The click event isn't bound back onto the anchor. The anchor looks like this: a class=show_reset_pass_box title=Lost Password?Lost Password?/ a What am I doing wrong? Many thanks in advance for any hekp. Rob.
[jQuery] Re: Disable a link temporarily
Rather than bindin/unbinding events, why not put a hidden label (or tag of your choice) there with the same text, then toggle between them: $(a, label).toggle(); Show the anchor or show the label. On Feb 7, 6:07 am, jQuery Lover ilovejqu...@gmail.com wrote: $('a.show_reset_pass_box').unbind('click'); This line is unbinding ALL click events. So the second click binding function is not fired, since it's not bound... Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 2:48 PM, rob303 rob.cub...@googlemail.com wrote: Hi, This should be easy. I want to disable a link and then re-enable it later. I have: $('a.show_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').unbind('click'); return false; }); Which works just fine. But then when I try to do: $('a.close_reset_pass_box').click(function() { // do some stuff $('a.show_reset_pass_box').bind('click'); return false; }); The click event isn't bound back onto the anchor. The anchor looks like this: a class=show_reset_pass_box title=Lost Password?Lost Password?/ a What am I doing wrong? Many thanks in advance for any hekp. Rob.