0
<input name="KeywordBox" class="BasicSearchInputBox" type="text" value="Keyword Search..."/>
<div class="searchBtnHolder"><a class="searchButton" href="#" type="submit"><span>Search</span></a></div>

I need to keep the user input text in the inputbox even after submit. When user submits, what happens is the value of inputbox is grabbed and added to the URL as querystring like mysite.com/index.aspx?kwd=userinput..

But it would be nice if we could keep what the user typed in so they know what they typed in and don't have to wonder!! Using jquery, is it possible? Can we not grab the value back from the url and set it back in the inputbox??

nnnnnn
  • 147,572
  • 30
  • 200
  • 241
Anju Thapa
  • 257
  • 6
  • 17
  • 32
  • What are you using using for the back end? (ASP.Net ,MVC... ?) – Jayantha Lal Sirisena Jan 06 '12 at 03:34
  • The answer will be virtually the same as to your own question on how to do the same thing with a select element: http://stackoverflow.com/q/8737025/615754 or your question (with an accepted answer!) on how to do the same thing with a radio button: http://stackoverflow.com/q/8736869/615754. I don't want to get too snippy about it, but will you be posting a question about how to do this for every input type? – nnnnnn Jan 06 '12 at 03:43

1 Answers1

0

You can submit the form without doing post back using jquery post. Then it will not remove the user entered content. http://api.jquery.com/jQuery.post/

$('#yourButtonId').click(function(){
  $.post('ajax/test.html', $('#yourFormId').serialize() ,function(data) {
      //call back function
      alert(data);
   });

});
Jayantha Lal Sirisena
  • 21,216
  • 11
  • 71
  • 92