Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function () { $("button#btn1").click(function () { var val = $("input").prop("value"); alert(val); }); }); </script> </head> <body> <h1>jQuery Manipulation Methods: prop()</h1> Enter Name: <input type="text" id="name" value="Roy" /> <button id="btn1">Display</button> </body> </html>
Result: