0

How can i open child window in jQuery and get selected values from generated <select multiple="multiple"> form element?

I can do it with window.open but as I am using jQuery I wonder if there are any plugins? Maybe handling this as a modal?

Luke Stevenson
  • 10,357
  • 2
  • 26
  • 41
Suhrob Samiev
  • 1,528
  • 1
  • 25
  • 57

2 Answers2

0

By default the jQuery context will be the current document root, you can pass in the handle of the child window into jQuery and it will search this instead

  wopts  = 'width=300,height=500,resizable=1,alwaysRaised=1,scrollbars=1';
  childW = window.open('', 'childW', wopts);

  $('#yourSelect', childW.document).val();

This will return an array containing the value of of each selected option.

Will
  • 1,622
  • 4
  • 25
  • 39
0

OK, I've found a solution to my problem !! If you also need to apply such feature to your web app just see it how I did it !! Maybe it'll help!!

$("#winAC" ).dialog({
                resizable: true,
                height:400,
                width: 50,
                modal: true,
                buttons: {
                    "Сохранить": function() {
                        $( this ).dialog( "close" );
                        var aAC=Array();
                        $("#sAC :selected").each(function(i,selected){
                        aAC.push($(selected).val());


                });
                alert(aAC);

                    },
                    "Отмена": function() {
                        //$("#ico"+rowID).html("");
                        $(this ).dialog( "close" );


                    }
                }
                });

            return false; 
        });
Suhrob Samiev
  • 1,528
  • 1
  • 25
  • 57