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
1 Answer
Reset to default 9You 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/