javascript replace only first instance .replace?
I have this var date = $('#Date').val(); this get the value in the textbox what would look like this 12/31/2009 Now I do this on it...
https://iskablogs.blogspot.com/2014/03/javascript-replace-only-first-instance.html
I have this
var date = $('#Date').val();
this get the value in the textbox what would look like this
12/31/2009
Now I do this on it
var id = 'c_' + date.replace("/", '');
and the result is
c_1231/2009
It misses the last '/' I don't understand why though.
Answer
That is default function in javascript. It replace only first instance
At this situation:
You need to set the