Javascript examples for jQuery Method and Property:val
Jquery replacing empty space in search form with #
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.js"></script> <script type="text/javascript"> window.onload=function(){//from w w w . j ava2s.co m $("#s").keyup(function () { var textValue = $(this).val(); textValue = textValue.replace(/ /g,"#"); $(this).val(textValue); }); } </script> </head> <body> <input type="text" value="" name="s" id="s"> </body> </html>