开发者

.show() not working on document ready

开发者 https://www.devze.com 2023-03-09 05:11 出处:网络
I\'m triggering a onchange event that i have on a textbox when the page loads $(document).ready(function () {

I'm triggering a onchange event that i have on a textbox when the page loads

$(document).ready(function () {
   $("input[id$=dpDeliveryDate]").each(function () {
       $(this).get(0).onchange();
   });
});

This gets fired correctly and is calling a function I have created.

I开发者_开发百科f I put in alerts into this function it will alert on the page loading correctly. So I know its calling the function just fine! but does not do the rest of the commands in the function

Also if after the page loads I change the textbox value it also fires correctly this time doing all the commands correctly in the function..

THe function basically needs to do

 $(this).parent().next().next().show();

So I cannot work out why it works onchange but not when onchange is triggered from the document.load?


Change

$(this).get(0).onchange();

to

$(this).change();
0

精彩评论

暂无评论...
验证码 换一张
取 消