Split number and put each digit to separate html element

Posted by Seven on Stack Overflow See other posts from Stack Overflow or by Seven
Published on 2012-09-19T09:24:45Z Indexed on 2012/09/19 9:37 UTC
Read the original article Hit count: 210

Filed under:
|
|

The problem is that I do not know how to break the loop for the first number and start again for the next one. Currently, one span.nNumber has a total digits of the two numbers (123456) and the next span.nNumber contains digits only from another number (456). Goal is to create sequence 123 and 456:

<span class='nNumber'>
 <span>1</span>
 <span>2</span>
 <span>3</span>
</span> 

and 

<span class='nNumber'>
 <span>4</span>
 <span>5</span>
 <span>6</span>
</span>

Example script: http://jsfiddle.net/PZ8Pt/2/

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about loops