1

I have an inputbox and a link for SEARCH styled to look like a Search button. When a user types in a keyword in the inputbox, I want to grab that keyword, pass it, and append it as a search query string to the search URL

/search/pages/physicians.aspx?v=relevance&s=Physicians&k=

So if Cardiologist is the keyword, it would be like:

http://ABChospital.org/search/pages/physicians.aspx?v=relevance&s=Physicians&k=Cardiologist

How can I achieve this in jquery?

<input name="KeywordBox" class="BasicSearchInputBox" type="text" value="Enter Keywords.."/>
            <div class="searchBtnHolder"> 
             <a class="searchButton" href="/search/pages/physicians.aspx?v=relevance&s=Physicians&k=" type="submit"><span>
             Search</span></a>
Adam Wenger
  • 17,100
  • 6
  • 52
  • 63
Aj Kancha
  • 37
  • 1
  • 8
  • 1
    Why don't you just use a `
    ` with an `` button? Is jQuery really necessary for this trivial HTML task?
    – BalusC Dec 06 '11 at 02:16

1 Answers1

1

Try this:

$('.searchButton').click(function() {
    location.href = this.href + $('.BasicSearchInputBox').val();
    return false;
});
Emre Erkan
  • 8,433
  • 3
  • 48
  • 53