Javascript examples for jQuery Method and Property:val
Give/set attribute value dynamically in jQuery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> <script type="text/javascript"> $(window).load(function(){// www.jav a2 s . c o m $('#btn').click(function(){ var text="helloworld"; $("input[name=newdirpath]").val(text); }); }); </script> </head> <body> <input type="text" value="home" name="newdirpath"> <input type="button" id="btn"> </body> </html>