将inputbox值作为查询字符串传递给URL
我有一个输入框和一个SEARCH
链接样式,看起来像一个搜索按钮。 当用户在输入框中键入关键字时,我想获取该关键字,将其传递,并将其作为搜索查询字符串附加到搜索URL
https://stackoverflow.com/search/pages/physicians.aspx?v=relevance&s=Physicians&k=
因此,如果Cardiologist
是关键词,那就像是:
http://ABChospital.orghttps://stackoverflow.com/search/pages/physicians.aspx?v=relevance&s=Physicians&k=Cardiologist
我怎样才能在jquery中实现这一点?
Search
试试这个:
$('.searchButton').click(function() { location.href = this.href + $('.BasicSearchInputBox').val(); return false; });
Interesting Posts