Autocomplete in JQUERY MOBILE text input -
i searched lot on net couldnt find solution. making webapp in want 2 textbox data input user. want autocomplete feature in textbox. list of tags autocomplete available locally. tried listview want after user select option autocomplete hints, textbox should have selected value, , through object, should value of textbox used javascript/php. basic thing, i'm not able do. please me out
i tried jsfiddle.net/ulxbb/48/ . problem in both listview gets same value after select in 1 listview.
in order not add same value both search input, need target them using .closest()
, .next()
, .prev()
, .find()
. jquery-mobile, enhances list-view data filter in different way.
<form> <input> </form> <ul data-role="listview"> <li> <a>text</a> </li> </ul>
the form
input
located, on same level of ul
. target input
box, need use .prev('form').find('input')
. check demo , new code below.
$("input[data-type='search']").keyup(function () { if ($(this).val() === '') { $(this).closest('form').next("[data-role=listview]").children().addclass('ui-screen-hidden'); } }); $('a.ui-input-clear').click(function () { $(this).closest('input').val(''); $(this).closest('input').trigger('keyup'); }); $("li").click(function () { var text = $(this).find('.ui-link-inherit').text(); $(this).closest('[data-role=listview]').prev('form').find('input').val(text); $(this).closest('[data-role=listview]').children().addclass('ui-screen-hidden'); });
Comments
Post a Comment