我有一个输入框和一个SEARCH
样式的链接,看起来像一个搜索按钮。当用户在输入框中键入关键字时,我想获取该关键字,将其传递,并将其作为搜索查询字符串附加到搜索网址
/search/pages/physicians.aspx?v=relevance&s=Physicians&k=
因此,如果Cardiologist
是关键字,那就像是:
http://ABChospital.org/search/pages/physicians.aspx?v=relevance&s=Physicians&k=Cardiologist
如何在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>
答案 0 :(得分:1)
试试这个:
$('.searchButton').click(function() {
location.href = this.href + $('.BasicSearchInputBox').val();
return false;
});