Javascript examples for jQuery Method and Property:prop
Use prop('defaultValue') to return attribute value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.3.js"></script> <script type="text/javascript"> $(function(){/*w w w . ja va2s .c o m*/ var x = $( '#q' ).prop( 'defaultValue' ); console.log( x ); }); </script> </head> <body> <form action="#"> <input id="q" class="autoclear blur" value="search" name="q" type="text"> </form> </body> </html>