jquery - How do you refresh an HTML5 datalist using JavaScript? -
I'm loading the options dynamically in an HTML5 daatist
element However, browser options Attempts to show the daistist
before being loaded. This result is not being displayed or sometimes a partial list is being displayed. Once the options are loaded, what is the method to refresh the list via javascript once?
HTML
& lt; Input type = "text" id = "component" list = "content" & gt; & Lt; Datalist id = "content" & gt; & Lt; / Datalist & gt;
JavaScript
$ ("# element"). ("Keyword", function (event) {var value = $ (this) .val (); $ .ajax ({url: "/ API / content", data: {search: value.length & gt; 0} Values + "*": ""}, success: work (content () ($ ("# content") for blank (); (in content var i) {$ (" ) .html (content [i] .name) .appendTo ("#content");} // One of the datalists to be rendered}}}};
Note: In Chrome and Opera, the entire list is displayed only if the user clicks on the input after entering the text. However, I will show the complete list as as the user type Firefox is not a problem because this option automatically refreshes when the options are updated
UPDATE
I am not sure that there is a satisfactory answer to this question, because I believe that this is a lack of only a few browsers. If any Datastists update
, Then the browser should refresh the list, but G browser (Chrome and Opera etc.) just do not do it. Question for a long time, but I have not been an alternative got the solution (test for IE and Chrome).
Comments
Post a Comment