title: Get Values in Iframe based UI Dialog from parent form having Master Page in ASP.NET using Jquery
body: <p>I have a Master Page based User entry form in asp.net. When user Clicks on a button it opens Jquery ui dialog popup in iframe . I have to access the values of text boxes of the parent entry form and pre-fill those in the popup.</p>
  
  <p><strong>Button Click on Entry form</strong></p>
  
  <pre><code> $(function () {
   $("input[id$='btnTccDetails']").click(function (e) {
                  e.preventDefault();
                  var $this = $(this);
                  var horizontalPadding = 30;
                  var verticalPadding = 30;
                  $('&lt;iframe id="externalSite" class="externalSite" src="' + 'tccDetails.aspx?action=ADD' + '" /&gt;').dialog({
                      title: ($this.attr('title')) ? $this.attr('title') : 'TCC Details',
                      autoOpen: true,
                      width: 1200,
                      height: 600,
                      modal: true,
                      resizable: true,
                      autoResize: true,
                      overlay: {
                          opacity: 0.5,
                          background: "black"
                      },
                      open: function (type, data) { $(this).parent().appendTo("form"); }
                  }).width(1200 - horizontalPadding).height(600 - verticalPadding);
  
              }); 
  
  
          });   //end of function()
  </code></pre>
  
  <p>// Popup   Javascript</p>
  
  <p>I was able to use the regular javascript .
  var tag = window.parent.document.forms[0].ctl00_MainContentHolder_txtTag.value;</p>
  
  <p>I need to do this in Jquery. I have tried this </p>
  
  <pre><code>   var tag = window.parent.jQuery('#txtTag').val();
  </code></pre>
  
  <p>This does not work.</p>
  
  <p>I have tried searching all the related post on here without much luck. </p>
  
  <p>**Solution:</p>
  
  <pre><code>var tag = $("input[id$='txtTag']", window.parent.document).val();**
  </code></pre>