Check if event exists on element

To check whether the event exists on element is possible with jQuery function date(). For example there is a form and if I need to bind an event submit() but before check submit event exists on element.

if(!$('#form').data('events.submit')){
	$("#form").submit(function(){
		//do submit action
		return false;
	});
}
This entry was posted in Programming and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.