Jquery execute onchange event on onload

后端 未结 6 1323
悲哀的现实
悲哀的现实 2020-12-01 16:02

I have a function that on change event run the post actions.

$(\"select#marca\").change(function(){
    var marca = $(\"select#marca option:selected\").attr(         


        
6条回答
  •  借酒劲吻你
    2020-12-01 16:08

    Really simple way it to just chain another .change() event to the end of your on change function like this:

    $("#yourElement").change(function(){
       // your code here
    }).change(); // automatically execute the on change function you just wrote
    

提交回复
热议问题