Steve
Steve

Reputation: 3080

.show() not working on document ready

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.

If 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?

Upvotes: 0

Views: 144

Answers (1)

epascarello
epascarello

Reputation: 207501

Change

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

to

$(this).change();

Upvotes: 1

Related Questions