jquery - Change div content with value of array in each function -
I have been trying this for the past several hours, I know that this is possible, what am I doing, my Below is a code that needs to be updated with the data in the array below. My code is:
var data = $ .trim ('test1, test2, test3'); Var data_array = data. Split (','); $ .each (data_array, function (key, value) {$ ("#expected rierz span"). Replacewith (value);}); While this is the HTML div where I need to insert content
& Lt; Period & gt; & Lt; / Span & gt; & Lt; / Div & gt; This function updates with only the first value of the ARR i.e. "Test1" and I want to display all 3 values one after the delay. I have also tried it with the settimeout () function, but that too is not working please help me Where am I saying? Thanks in advance
To add value to the period, try it:
$ ("# waiting scheduling period"). Html (value); To remove the span and keep the editing array:
if ($ ("# waiting scheduling period"). Length () ) $ ("#internationalcertain span"). Deletion (); $ ("#CancerNet #"). Attachment (value); Update: Show element with delay: var i = 1; $ .each (data_array, function (key, value) {setTimeout (function () {$ ("# waiting scheduling period"). Html (value);}, 500 + (i * 500)); i = i + 1;});
Comments
Post a Comment