Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript onsubmit with form with multiple submits buttons

Tags:

javascript

I have a form with two submits buttons, one called 'display' and the other called 'disenrol'. The display submit doesn't need confirmation whereas the other does. Originally I was going to use

onsubmit="return confirm('Are you sure you want to remove the modules?');"

But of course that won't work because it reacts to both of the submits. Is there a way I can specify which submit it should worth with? (I'm quite new to javascript so please be gentle with me)

Thanks

like image 723
tatty27 Avatar asked May 03 '26 09:05

tatty27


1 Answers

Try this:

<input type="submit" onclick="return confirm('Are you sure you want to remove the modules?');" value="submit1" />
like image 109
karaxuna Avatar answered May 05 '26 21:05

karaxuna