George
George

Reputation: 81

how to call this function from js?

The js function is automatically called when submit button is clicked..ie,by using submit's id my question is how to call this function from another js function.. Please look at the function i have to call.

$(document).ready(function(){
    $('#modalLink').modal({              //id of submit is modallink
        trigger: '#modalLink',        //modal is a function of a js plugin
        overlay:'div.overlay',  
 });
}); 

the html for submit is given below

<input type="submit" id="modalLink" onclick="myfunction()" />

it is through myfunction() i have to call that function..

Upvotes: 0

Views: 92

Answers (2)

Evert
Evert

Reputation: 8541

The easiest way is to trigger a #modalLink click programatically, if it is accessible, and then it will handle the modal opening for you.

eg:

var SomeFunction = function(){
     $('#modalLink').trigger("click");
}

Upvotes: 1

Felix
Felix

Reputation: 38102

Try to do:

$(document).ready(function(){
    $('#modalLink').click(function() {
        $(this).modal({
            trigger: '#modalLink',      
            overlay:'div.overlay',  
        });
    });
});

Upvotes: 1

Related Questions