Re: [jQuery] confirm link

2007-03-06 Thread Sam Collett
On 05/03/07, James Thomas [EMAIL PROTECTED] wrote: Close ... try this: $(a).click(function(){return alertSave($(this).attr(href));}); function alertSave(url) { var dataControl = $('#changedAppointments').attr(value); if (dataControl.length 0) { if

Re: [jQuery] confirm link

2007-03-06 Thread James Thomas
That's true - I didn't change it because I thought there could be some cases where alertSave() could be called outside of the 'a' thing - if that's not the case, then this version is definitely better. You could go so far as to eliminate the variable as well and just do: if

Re: [jQuery] confirm link

2007-03-05 Thread James Thomas
You need to return false if you don't want something to happen. so if (confirm('whatever')) { do_whatever(); } else return false; smeranda wrote: When a user clicks a link and a form field currently has data, a confirmation box appears. This is close to working, but if a user clicks

Re: [jQuery] confirm link

2007-03-05 Thread smeranda
Still no luck, this is what I have: $(a).click(function(){alertSave($(this).attr(href));}); function alertSave(url) { var dataControl = $('#changedAppointments').attr(value); if (dataControl.length 0) { if (confirm(You have made changes to this date which have

Re: [jQuery] confirm link

2007-03-05 Thread Indigo
On Monday 05 March 2007 13:56, smeranda wrote: Still no luck, this is what I have: $(a).click(function(){alertSave($(this).attr(href));}); function alertSave(url) { var dataControl = $('#changedAppointments').attr(value); if (dataControl.length 0) { if (confirm(You have made changes

Re: [jQuery] confirm link

2007-03-05 Thread smeranda
That's perfect! Thanks James. James Thomas wrote: Close ... try this: $(a).click(function(){return alertSave($(this).attr(href));}); function alertSave(url) { var dataControl = $('#changedAppointments').attr(value); if (dataControl.length 0) { if