I need to simply add commas to numbers in my code. I have tried a lot of hints here but something seems to be wrong.
I have tried with regex and the toLocalString()
method and both haven't worked, can someone help me find the correct solution.
<script type="text/javascript">
$(document).ready(function () {
// $("#price").toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
$('#price').html.toLocaleString('en');
});
</script>
Here's my element:
<strong id="price"><%# Eval("OfferPrice") %></strong>
Everything seems ok, can anyone help please. Thanks a lot!