快速提问。
我正在寻找一种方法来填充我的JQuery搜索框,并在URL中输入值。
所以我有一个看起来像这样的网址:
的http:// * * /酒馆/ 3 /位点/ Ti的/存储/移动/页/ productList.page
现在如果我在最后输入这样的东西
的http:// * /pub/3/site/ti/store/mobile/page/productList.page?=brand
我想这会出现在我的搜索框中。我怎么能做到这一点?
提前致谢。
答案 0 :(得分:2)
您可以访问location.search
,其中包括?
。
$('input').val(location.search.substring(1)); // set input value to the
// ?... data, omitting the ?