Assign Div data attribute as Data Source to JQuery AutoComplete
<p>I am using a <strong>JS</strong> method to assign the names of computer languages to data attribute of <code>div</code>
e.g</p>

<pre><code>&lt;div id="Languages" data-Languages=''&gt;&lt;/div&gt;
</code></pre>

<p>and <code>js</code> code</p>

<pre><code>var langs='["Perl", "PHP", "Python", "Ruby", "Scala", "C#"]';
$('#Languages').data('Languages', langs);
</code></pre>

<p>but when i type text in the textbox it gives me an error
Object Expected
i am using this line for autocomplete</p>

<pre><code>$(function () { 
    $("#tags").autocomplete({ source: $('#Languages').data('Languages') }); 
}); 
</code></pre>

<p>it works totally fine when i make another variable and pass it as a source as implemented in jquery <a href="http://jqueryui.com/autocomplete/" rel="nofollow">website</a></p>

<p>i want to handle it with div's data attribute because in future i want to use <code>JSON</code> that fetches autocomplete data on page load and assign it to div data attribute.</p>

<p>sorry if that question sounds stupid, its my 2nd day with <code>jquery</code> and all that stuff.</p>
