Update JavaScript variable in jQuery -


please can on how value jquery javascript?

var mytitle = "abctitle";  function showtitle(myvar) {     mytitle = myvar;         alert(mytitle);  }  $(document).ready(function() {     alert(mytitle); //i alert "abctitle"     mytitle = "changed"; }); 

how can value set in query outside call in jscript?

your code right, , supposed to

var mytitle = "abctitle";    var e = document.getelementbyid('show');  e.onclick = showtitle;    function showtitle(){   alert(mytitle);     }    $(document).ready(function() {      alert(mytitle); //i alert "abctitle"      mytitle = "changed";  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>  <button id="show">click me</button>

this alert mytitle new title, showing 'jquery' can access javascript variables , change them.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -