replace - Use javascript to add style to every digit in a string -
here's js code:
<script language='javascript' type='text/javascript'> var myoldstring = "1,2,3,4,5,6</br>1,2,3,4,5,6</br>1,2,3,4,5,6" var mynewstring = myoldstring.replace(/,/g , " "); document.write(mynewstring); </script>
works fine, need add style="padding:5px"
every digit.
i tried lot of different code vairations none of them work.
thank's help!
do mean that?
<script language='javascript' type='text/javascript'> var myoldstring = "1,2,3,4,5,6</br>1,2,3,4,5,6</br>1,2,3,4,5,6" var mynewstring = myoldstring.replace(/([0-9]+),?/g , ' <span style="padding:5px">$1</span> '); document.write(mynewstring);</script>
Comments
Post a Comment