html - JQuery is loading but my javascript isn't -


so, according firefox debugger both index.js , jquery.js loading fine code in index.js not running.

here js:

 var text = "js says hi";  var num1 = 33.6669;  var num2 = 322.0258;   $('#body').ready(function () {      pageload();  });   $('#button').click(function () {      buttonclick();  });    function pageload() {      $('#button').css('visibility","visible');  }  function buttonclick() {      $().post('server.php', {text:text,num1:num1,num2:num2});  } 

here html:

<head>     <meta charset="utf-8">     <title>bullshit</title>      <script type="text/javascript" src="jquery3.0.js"></script>     <script type="text/javascript" src="index.js"></script>  </head> <body id="body">     <button id="button" style="visibility:hidden">click</button> </body> </html> 

you have several errors in code:

  • $('#body') should $(document)
  • $().post should be: $.post
  • $('#button').css('visibility","visible'); should $('#button').css('visibility','visible');

    var text = "js says hi"; var num1 = 33.6669; var num2 = 322.0258;  $(document).ready(function () {     pageload();      $('#button').click(function () {         buttonclick();     }); });  function pageload() {     $('#button').css('visibility','visible'); }  function buttonclick() {     $.post('server.php', {text:text,num1:num1,num2:num2}); } 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -