I want to remove a string that is between two characters, let’s say for example I want to replace all characters of the string between "value=" and " " with "" so value will always equal “”;
Example:
"<input value=98 name=anything>"
To this
"<input value= name=anything>"
How could I do it in JavaScript?
You could probably use regular expressions here, if the structure of the HTML is always like this.
But it would get more complicated if you had to consider
value=foo,value="foo"orvalue="foo bar"too.Here is a more exciting way, which would work with any kind of HTML string and
value:DEMO