How to add extra text to input value result using jQuery -
my html form is:
<form id="search" action="form.html" method="get"> <input type="text" id="keyword" name="search" placeholder="keywords" /> </form>
when type "test" , hit enter, go form.html?search=test
using jquery, how can add "xx-" on result, i.e. form.html?search=xx-test ?
thank you
use keypress
catch enter event , make url redirect this.
$('#keyword input').bind('keypress', function(e) { if(e.keycode==13){ var keyword= $('#keyword').val(); window.location = form.html?search=xx_' + keyword; } });