Tuesday 15 March 2011

jquery - Why am I not able to get the data() value of my autocomplete input field? -



jquery - Why am I not able to get the data() value of my autocomplete input field? -

i'm using jquery autocomplete on next input

<input data-searchurl="some url" />

but when seek retrieve info value searchurl, undefined. hmm... same if seek using attr well.

$('input').autocomplete({ source: function (request) { var url = $(this).data('searchurl'); (...)

see fiddle here: http://jsfiddle.net/34ewgg7j/3/

why autocomplete preventing me doing this?

use $(this.element).data('searchurl') , works, point each individual input in collection, if have multiple inputs in selector.

jquery autocomplete attributes

No comments:

Post a Comment