title: Get values of Textbox in jquery Modal dialog
body: <p>I'm opening a view in jquery modal dialog like this</p>
  
  <pre><code>$("a.OpenView").on('click', function () {
         &gt;&lt;/div&gt;")
              .addClass("dialog closePopup")
              .attr("id", "popup1")
              .appendTo("body")
              .load("../../ControllerName/_partialView")
              .dialog({
                  title: "LogIn",
                  modal: true,
                  height: "auto",
                  minHeight: 260,
                  maxHeight: 260,
                  width: 450,
                  left: 0,
                  zIndex: 1001
              });
  
      });
  </code></pre>
  
  <p>Html</p>
  
  <pre><code>&lt;table cellpadding="0" cellspacing="0"&gt;
          &lt;tr&gt;
            &lt;td align="center"&gt;&lt;input name="" type="text" value="" title="User Name" class="width190" id="txtUserName" onfocus="txtFocus(this)" onblur="txtFBlur(this,'0')"/&gt;&lt;/td&gt;
            &lt;td align="center"&gt;&lt;input name="" type="password" value=""  title="Password" class="width190" id="txtPassword" onfocus="txtFocus(this)" onblur="txtFBlur(this,'1')"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td colspan="2" align="center"&gt;&lt;input name="" type="submit" class="blue_btn" value="Sign In"  id="btnLogIn" onclick="javascript:return LogIn()"/&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
        &lt;/table&gt;
  </code></pre>
  
  <p>Now As soon as i close dialog once and then i reopen it again and enter username and password...I get <code>""</code> as value of both textbox...</p>
  
  <p>What might be the possible reason for this, what i'm doing wrong?</p>
  
  <p>LogIn function here</p>
  
  <pre><code>function LogIn() {
      var username = $('#txtUserName').val();
      var password = $('#txtPassword').val();
  }
  </code></pre>