html - jQuery ui autocomplete array should come form text() -


jquery ui autocomplete array should:

find fiddle demo

var availabletags = [     "how doing?",     "what doing?",     "what did eat today?",     "be yourself",     "try new things" ]; 

these variables should come .text() question form tag.

<a class="toggle faqcategory" href="">how doing?</a> <a class="toggle faqcategory" href="">what doing?</a> <a class="toggle faqcategory" href="">what did eat today?</a> <a class="toggle faqcategory" href="">be yourself</a> <a class="toggle faqcategory" href="">try new things</a> 

i hope got want.

i don't want static input in jquery ui arrays should come dynamically per text of question tag.

find fiddle

in opinion, can keep availabletags array. this,

var availabletags =[]; $(".faqcategory").each(function(){  availabletags.push($(this).text());  }); 

so availabletags iterate anchor tags class faqcategory. hope helps.


Comments