change event not working for a textbox when the value is assigned externally

后端 未结 6 1853
臣服心动
臣服心动 2021-01-22 17:14

I have a textbox and a button. When I click the button, it sets certain value in the textbox. I want to submit the page whenever the value of the textbox is changed.

Ple

6条回答
  •  不要未来只要你来
    2021-01-22 17:49

    $(document).ready(function () {
        $("input").change(function () {
            Submitform();//Function for submitting form
        });
        $("#click").click(function () {
            $('.set').val('Why am I not getting the alert saying  - Changed! ');
            Submitform();//Function for submitting form
        });
    });
    

    Function for submitting the form

    function Submitform(){
    $("#YourformId").submit();//Submits your form
    }
    

提交回复
热议问题