Skip to content Skip to sidebar Skip to footer

Yii, Attaching A Javascript Function On Submit Button

I want to attach a function to my submit button. But my code doesn't seem to be calling the function. Basically what I want it to do is, enabling all disabled field when the form i

Solution 1:

Remove onclick event, and add

$("your_form_name").submit(function(){
   enableField();
}); 

Solution 2:

This is the correct way of attaching a submit function:

$(function() {
    $("#formName").submit(function() {
        alert("hi");
        //do whatever 
    });
});

Post a Comment for "Yii, Attaching A Javascript Function On Submit Button"