$("#mylink").live("click", function() { alert("this alert will fire"); });
$("#mylink").die("click", function() { alert("this alert will not fire"); }); On Fri, Jun 5, 2009 at 9:31 PM, James <james.gp....@gmail.com> wrote: > > I didn't look through what the code does, but doing what you want to > do should have the code separated out similar to this: > > http://snipt.org/kGk > > On Jun 5, 8:32 am, "Dave Maharaj :: WidePixels.com" > <d...@widepixels.com> wrote: > > This is what I have so far > > So this is the initial click which loads a form . > > > > $('a[class^="edit_"]').click(function(){ > > var url_id = $(this).attr('href'); > > var e = $(this).attr('class'); > > var x = $(this).attr('id').split('_'); > > var y = x[0]; > > var z = x[1]; > > //alert(e); > > $('a[class^="edit_"]').unbind('click'); > > $('a[class^="edit_"]').fadeTo('slow' , 0.25 , > > function() { > > $('#resume_'+z).slideUp( 500 , > function(){ > > $('#loading_'+z).show('fast', > > function() { > > $('#resume_'+z).load( > url_id > > , function(){ > > > > $('#loading_'+z).hide(function(){ > > > > $('#resume_'+z).slideDown(500).fadeTo('fast', 1.0).fadeIn('slow'); > > > > }); > > > > > }); > > }); > > return false; > > }); > > }); > > }); > > > > Then once the form is sumbitted > > > > $('#UpdateForm').bind('submit', function() { > > > > var queryString = > $('#UpdateForm').formSerialize(); > > $(this).ajaxSubmit({ > > type: 'post', > > url: 'update.php , > > data: queryString, > > target: '#resume_'+skill, > > success: afterEffects, > > > > }); > > > > return false; // <-- important! > > > > }); > > > > function afterEffects () > > { > > > > > $('#loading_'+skill).hide(function() > > { > > > > $('#resume_'+skill).slideDown( 500, function() { > > > > $('a[class^="edit_"]').fadeTo('slow' , 1.0 ); > > > > //$('a[class^="edit_"]').bind('click'); > > }); > > }); > > } > > > > -----Original Message----- > > From: James [mailto:james.gp....@gmail.com] > > Sent: June-05-09 3:53 PM > > To: jQuery (English) > > Subject: [jQuery] Re: Help preventing click > > > > Just had to ask, are you also providing the callback function also? > > > > $('a[class^="edit_"]').bind('click'); > > > > should be: > > $('a[class^="edit_"]').bind('click', someFunction); > > > > On Jun 5, 8:13 am, MorningZ <morni...@gmail.com> wrote: > > > First off, you are starting off with some really bad habits... > > > > > something like > > > > > <a href="..." class="edit_one">One</a> <a href="..." > > > class="edit_two">Two</a> <a href="..." class="edit_three">Three</a> > > > > > and then saying > > > > > 'a[class^="edit_"]' > > > > > is a bad way to access those links, as "class" acts a little different > > > than a parameter like "width" or "id" > > > > > something like > > > > > <a href="..." class="edit one">One</a> <a href="..." class="edit > > > two">Two</a> <a href="..." class="edit three">Three</a> > > > > > and then saying > > > > > 'a.edit' > > > > > is much better jQuery-wise > > > > > Second, if the sole purpose of these <a> objects is to load a form or > > > something, and *not* take the user somewhere (primary purpose of a > > > hyperlink), then advice: don't use a hyperlink for that then > > > > > On Jun 5, 2:04 pm, "Dave Maharaj :: WidePixels.com" > > > > > <d...@widepixels.com> wrote: > > > > I have 6 links , each loads a form into its respective div. How can > > > > I disable the links if one of the 6 is clicked preventing a user > > > > from opening up 6 forms at once? > > > > > > I have > > > > $('a[class^="edit_"]').unbind('click'); > > > > which stops the click from working but once the form is submitted i > > > > now need to enable the click function again to those links. > > > > > > I added > > > > $('a[class^="edit_"]').bind('click'); but that does nothing. > > > > > > Suggestions? Am i missing something? > > > > > > Dave >