最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How can I replace dynamically the filter search bar in jQuery MOBILE? - Stack Overflow

programmeradmin3浏览0评论

Let's say I got some values from GET from an url. How can I "paste" that value inside the search filter in jquery mobile and auto-perform the search.

for example: i have a list of name | town | adresses | other info

i'll get a value from the url

and I want the filter list to be autoset to Sydney and perform the search with that term.

I hope I was clear enough... Thank you very much

Let's say I got some values from GET from an url. How can I "paste" that value inside the search filter in jquery mobile and auto-perform the search.

for example: i have a list of name | town | adresses | other info

i'll get a value from the url http://url.?town=Sydney

and I want the filter list to be autoset to Sydney and perform the search with that term.

I hope I was clear enough... Thank you very much

Share Improve this question asked Dec 2, 2011 at 19:07 OWADVLOWADVL 11.2k7 gold badges57 silver badges67 bronze badges 2
  • Check this out: stackoverflow./questions/901115/… – jValdron Commented Dec 2, 2011 at 19:14
  • yes, but I was looking more for a jQuery mobile solution...not Jquery in general. thanks tho. – OWADVL Commented Dec 3, 2011 at 11:33
Add a ment  | 

1 Answer 1

Reset to default 9

You need to perform two actions:

0) add an identifier (like id="myFilter") to the list so you can later select the filter input

1) set the search filter input to your value

2) trigger the change event on the input so the list is filtered

$('#myFilter').prev('form[role="search"]').find('input[data-type="search"]')
    .val("myValue")
    .trigger('change');

I've put a demo on jsFiddle: http://jsfiddle/jbmoelker/VZjvZ/7/

发布评论

评论列表(0)

  1. 暂无评论