2

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.com?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

OWADVL
  • 10,704
  • 7
  • 55
  • 67

1 Answers1

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.net/jbmoelker/VZjvZ/7/

Jasper Moelker
  • 1,390
  • 13
  • 10