javascript - Why is jQuery returning each character of the contents of my span element when I loop it? -


OK, I have a bunch with an end time class. I want to freely collect each content from others.

  & lt; Span class = 'endtime' & gt; 2011-03-29 00:01:03 & lt; / Span & gt; & Lt; Span class = 'endtime' & gt; 2011-03-31 19:20:11 & lt; / Span & gt; & Lt; Span class = 'endtime' & gt; 2011-03-28 19:00:12 & lt; / Span & gt;   

But the problem is, when I do this:

  var text = $ ('. Endtime'). Text (); (Var i = 0; i & lt; text.length; i ++) {$ ('counter'). Countdown ({:: text [i], format: 'hms'})}   

Is there only 1 character in the content of the text? How to return the whole characters to it?

calling .text () to execute on each item in the archive Alternatively, you can pass in the function.

  $ ("span.endtime"). Text (function (i, text) {$ ('. Counter') .downdown ({: text: format: 'hms'})}); Simple examples on   



Comments