vendredi 27 février 2015

javascript function in td element with passing parameter

I have the following element that displays data retrieved from the database to display the followers an artist has.



<td>
<span id="followers">
<? echo empty($artist['Artist']['followers']) ? 'N/A' : number_format($artist['Artist']['followers']);?>
</span>
</td>


There are some values that are very large and go upto 6 digits. I want to write a Javascript function that will take the substring and only display first 3 digits.


How can I write a function and pass the parameter as the value of : $artist['Artist']['followers']


I can do this in php, but I need to do it in javascript!





Aucun commentaire:

Enregistrer un commentaire