samedi 16 décembre 2017

JQuery function to if else

I would like to use the below script with if else statement. If "-0" is found run script to remove the minus, else do nothing. Or any suggestion if there is a better way of doing this?

$('ul.tableTime li:nth-child(3)').each(function() {
var $this = $(this);

$this.text($this.text().replace(/-0/g, '0'));
});

Aucun commentaire:

Enregistrer un commentaire