Remove all characters after a comma with jQuery -


i remove characters after "," in string using jquery, targeting class of element. other solutions found using javascript, targeting string instead of class.

my code is:

<td class="priceinfo">€779,34&nbsp;</td> 

how remove characters after "," in text of td element?

you can use jquery's text() method achieve this:

$('.priceinfo').text(function(i, t) {     return t.substr(0, t.lastindexof(',')); }); 

working example


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -