Question

I am not sure if this can be done. In the parent window, I have the following line,

<input type="hidden" name="myField" id="myField" value="">

This parent window would open a pop-up window, where it would allow the users to make their own selections. Upon clicking submit in this pop-up window, it would assign the selection to myField in the parent window and then the pop-up window would close.

All these are working fine. I put a temporary link on the parent window that would display the value of myField. Upon the closing of the pop-up window, I clicked this link and it showed the correct values.

My problem is, I have the following codes in the parent window,

  $('#myField').change(function(e) {
    alert("changed!!!");
  });

The alert box would never display, which means that the change event is not called in the parent window. So, my question is, is it possible to capture the change event on myField in the parent window?

Thanks in advance, Monte

Was it helpful?

Solution

try this: trigger

$('selector for parent window')
    .find('#myField')
        .val('new value')
        .trigger('change');

OTHER TIPS

You will need to use live

$('#myField').live("change", function() {
alert("changed!!!");
})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top