0

We have one page that has a "jQuery" document.ready script function. It is working fine if we were to browse it in a new tab. But when we try the same page in a Popup the script does not work (document.ready).

The following function is used to open the popup in SharePoint 2013 Online.

aspx code:

<a  href="javascript:OpenPopUpPage('/NewForm.aspx');">MyPage</a>`

Jquery code:

$(document).ready(function(){
$('#ctl00_ctl41_g_9efece1f_fded_45df_a1be_364581e26f60_ff4_1_ctl00_DropDownChoice').change(function() {
       if($(this).val() == 'New Collection Concept')
         {
           $('#updateCollection').hide();
           $('#newCollection').show();
         }
       else
         {
           $('#newCollection').hide();
           $('#updateCollection').show();
         }
     });
4
  • Can you post the full method call line, with parameters you are passing
    – Unnie
    Commented Apr 23, 2014 at 7:00
  • Hi Unnin i have added all code please let me know if you need more information.
    – Pankaj
    Commented Apr 23, 2014 at 7:22
  • @Unnie Maybe this is for you: stackoverflow.com/questions/11453303/…
    – Nk SP
    Commented Apr 23, 2014 at 7:35
  • Is this new code opened in new iframe? or as new DOM element?
    – przemo_li
    Commented Dec 10, 2014 at 13:10

1 Answer 1

1

can you try window.onLoad function instead (like iframe).

window.onload = function() {
    $('#ctl00_ctl41_g_9efece1f_fded_45df_a1be_364581e26f60_ff4_1_ctl00_DropDownChoice').change(function() {
   if($(this).val() == 'New Collection Concept')
     {
       $('#updateCollection').hide();
       $('#newCollection').show();
     }
   else
     {
       $('#newCollection').hide();
       $('#updateCollection').show();
     }

};

i could be wrong but i belive that the dom is already ready as its not a parent element but rather a child element of the parent that returns the document ready! otherwise create a iframe and use onload or document ready within that!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.