jaymc Posted August 4, 2008 Share Posted August 4, 2008 I want to run some javascript on my index page to monitor every submit button so that when its pressed it disables so a user can keep clicking it I know I can do this using an ONCLICK, but I dont want to add this to every submit button I want to put it in my master .js file to apply to any submit button on the page Link to comment https://forums.phpfreaks.com/topic/118066-solved-disable-submit-button/ Share on other sites More sharing options...
vikramjeet.singla Posted August 4, 2008 Share Posted August 4, 2008 you can apply same css class to each submit and disable them using DOM.... Link to comment https://forums.phpfreaks.com/topic/118066-solved-disable-submit-button/#findComment-607367 Share on other sites More sharing options...
jaymc Posted August 4, 2008 Author Share Posted August 4, 2008 Can you provide an example? Link to comment https://forums.phpfreaks.com/topic/118066-solved-disable-submit-button/#findComment-607397 Share on other sites More sharing options...
JasonLewis Posted August 4, 2008 Share Posted August 4, 2008 You would still need to have this in a submit button: <input type="submit" name="submit" id="submit" onclick="javascript: disableSubmit(this);" /> Then have the appropriate javascript. But you would need to specify it in each one, as far as I know. Link to comment https://forums.phpfreaks.com/topic/118066-solved-disable-submit-button/#findComment-607410 Share on other sites More sharing options...
jaymc Posted August 4, 2008 Author Share Posted August 4, 2008 What about event handlers? Link to comment https://forums.phpfreaks.com/topic/118066-solved-disable-submit-button/#findComment-607495 Share on other sites More sharing options...
KevinM1 Posted August 4, 2008 Share Posted August 4, 2008 I want to run some javascript on my index page to monitor every submit button so that when its pressed it disables so a user can keep clicking it I know I can do this using an ONCLICK, but I dont want to add this to every submit button I want to put it in my master .js file to apply to any submit button on the page Well, like vikramkeet.singla said, you can filter out the submits by CSS class. It's easiest to use jQuery for this: $(".yourClassName").click(function() { //do whatever you want here }); So, give your submits a class to replace 'yourClassName' and fill out the body of the onclick callback function. That will attach that onclick callback to every element of that class. Link to comment https://forums.phpfreaks.com/topic/118066-solved-disable-submit-button/#findComment-607527 Share on other sites More sharing options...
jaymc Posted August 4, 2008 Author Share Posted August 4, 2008 Cheers Link to comment https://forums.phpfreaks.com/topic/118066-solved-disable-submit-button/#findComment-607570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.