I want to pass the form name to the function and then confirm they are read to delete it after that I want to change the action then submit the form.
function deletePhone(myForm){
var r=confirm('Are you sure you want to delete this phone?');
if(r==true){
$(myForm).attr("action","index.cfm?deleteThis=1");
$(myForm).submit();
}
}
currentrow is a variable that I am using because I am creating multiple forms and it holds the currentCount for the form.
<a href="javascript:deletePhone('EditPhone_form_#currentrow#');">X Delete Phone</a>
Example:
- EditPhone_form_1
- EditPhone_form_2
- EditPhone_form_3
- EditPhone_form_4
It seems that when you’re doing the jQuery lookup based on the ID, it isn’t formatted correctly.
Try this:
Note the extra # added
Edit:
You haven’t posted the whole HTML of the form, but presumably the tag is in the form itself, right? If yes, then you could also try this:
<a href="javascript:deletePhone($(this));">X Delete Phone</a>