javascript - jquery function not calling on button click -


below code, want alert "hi" , "hello" can put actual codes there.

<html> <head> <script type="text/javascript"  src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> if (typeof jquery == 'undefined') {     document.write(unescape("%3cscript src='jquery-1.11.1.min.js' type='text/javascript'%3e%3c/script%3e")); } </script>    <script src="jquery-ui.js"></script>         <link rel="stylesheet" href="jquery-ui.css"> </head>  <script>  $(document).ready(function(){     alert("hi");     $('form[name="lgform"]').submit(function(evnt){         evnt.preventdefault();     });      $("#btn_login").click(function(){                alert("hello");     });  }); </script>  <body> <form name="lgform"> <div>  <table id="table"  >     <tr>          <td width="35px"><input id="mob"  type="text" name="mob_nu"></td>          <td width="35px"><input id="pswd"  type="password" name="pswd_vl"></td>          <td width="100px"><input type="button" name="login_btn" id="btn_login" value="login"></td>               </tr>  </table> </div> </form>  </body> </html> 

button click event not working, using same jquery library in other places working fine. have call ajax in page need call button click without submitting page, have few more buttons add. piece of code appreciated , in advance.

when tried code got error

ignored call 'alert()'. document sandboxed, , 'allow-modals' keyword not set

and when tried after replacing alert's console.log working fine.

your code working fine, replace alert's console.log()


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -