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;     }  });​ 

Popular posts from this blog

node.js - How do I prevent MongoDB replica set from querying the primary? -

c# - Randomly pick a specific int from a 2D Array -

php - Angularjs http.delete is not working after deploying project on server -