Vengat_93 Vengat_93 - 6 months ago 49
jQuery Question

how to create two event for html attribute

I would like to create two event by reusing the code of a method, this is my code, how could i able to create two event for single element using jQuery

blur : val (),
submit:val ()

function val() {
if ($('#country_ID').val() == '')
formval = false;

Thanks in Advance..


The simplest way to do it is as follows:

$('#country_ID').bind('blur submit', function (e) {
    // This is your combined function
    val(); //calling the required function