title: How to pass input empty validation in iframe
body: <p>I simulate keypress event and  bind to the input element, but the login button still cann't use. </p>
  
  <p>Here is the test address: <a href="http://124.207.226.122:21701/test.html" rel="nofollow">http://124.207.226.122:21701/test.html</a>.</p>
  
  <p>My question is how to pass input empty validation in iframe.</p>
  
  <p>Thanks.</p>
  
  <p><strong>parent page</strong>:</p>
  
  <pre><code>&lt;body&gt;
      &lt;div style="margin:0;"&gt;
          &lt;iframe id="hk_iframe" src="Ng-Click-1.html" frameborder="0" width="100%" Height="768" scrolling="no"&gt;do not support iframe&lt;/iframe&gt;
      &lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
          jQuery.fn.simulateKeyPress = function(character) {  
              jQuery(this).trigger({ type: 'keypress', which: character.charCodeAt(0) });  
          };  
  
          $(function() {
              $('#hk_iframe').load(function(){    
                  var $iframe = $(this), 
                  $contents = $iframe.contents(); 
                  window.setTimeout(function(){
                      $contents.find('#textbox').keypress( function(e) {  
                          //alert( String.fromCharCode( e.which ) );  
                          console.log(e);  
                      });  
                      $contents.find('#textbox').simulateKeyPress('x');           
                      $contents.find('#textbox').val('user1');
  
                      $contents.find('#password').keypress( function(e) {  
                          //alert( String.fromCharCode( e.which ) );  
                          console.log(e);  
                      });  
                      $contents.find('#password').simulateKeyPress('x');          
                      $contents.find('#password').val('user123456');
  
                      $contents.find('#login').click();
                  }, 1000);
              });
          });
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>child page:</strong></p>
  
  <pre><code>&lt;body ng-app=""&gt;
      &lt;form name="form"&gt;
          &lt;div ng-hide="isShow"&gt;
              User Name  &lt;input type="text" required ng-model="userName" id = "textbox"/&gt;&lt;br /&gt;&lt;br /&gt;
              Password &lt;input type="password" required ng-model="password" id="password"/&gt;&lt;br /&gt;&lt;br /&gt;
              &lt;input type="button" ng-disabled="form.$invalid" ng-click="isShow = true" value="Login" id="login"/&gt;
          &lt;/div&gt;
          &lt;div ng-show="isShow"&gt;
              Successfully Login.&lt;br /&gt;
              &lt;input type="button" ng-click="isShow = false;password='';userName=''" value="Logout" /&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>