How can I remove "-" from a whole string?
I am using this line which works but only for the first "-", it doesn't remove the other "-".
image name: cropped-Journal-trend-02.png
imagePath: $(this).find('td:eq(3)').html().replace(('-', '')
How can I remove "-" from a whole string?
I am using this line which works but only for the first "-", it doesn't remove the other "-".
image name: cropped-Journal-trend-02.png
imagePath: $(this).find('td:eq(3)').html().replace(('-', '')
You can add g
modifier that is global.It does not return after first match
imagePath: $(this).find('td:eq(3)').html().replace(/-/g, '')
var imagePath = "cropped-Journal-trend-02.png";
var newImagepath = imagePath.replace(new RegExp('-', 'g'),"");
Can you pls try this. It will remove all - from your string