Jquery .val() changes the value in dom - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:val

Description

Jquery .val() changes the value in dom

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
  <title>Demo by roXon</title> 
 </head> //from   w  w w  .ja v  a 2 s  .c o m
 <body> 
  <input type"text" id="my" value="world"> 
  <script>
    $(function(){
         $("#my").val("hello");
         console.log($("#my").val());
    });

      </script>  
 </body>
</html>

Related Tutorials