I m trying to replace some values from a date but it only change the first found value.
var date= cars.getAttribute("myLastDate");
var dateChanged= date.replace("/", ",");
alert (dateChanged);
Best regards.
I m trying to replace some values from a date but it only change the first found value.
var date= cars.getAttribute("myLastDate");
var dateChanged= date.replace("/", ",");
alert (dateChanged);
Best regards.
If you don't need any regular expressions then I recommend the simpler split/join method to do search and replace.
var dateChanged = date.split("/").join(",");
You need to invoke the global flag using a regular expression:
var dateChanged= date.replace(/\//g, ",");
replace in javascript use regular expression , u have to add /g at the end
date.replace(text/g,' ')