Remove a semicolon in a string by JavaScript -
this question has answer here:
how can remove semicolon (;
) string using javascript?
for example:
var str = '<div id="confirmmsg" style="margin-top: -5px;">'
how can remove semicolon str
?
you can use replace
method of string object. here w3schools says it: javascript replace().
in case following:
str = str.replace(";", "");
you can use regular expression:
str = str.replace(/;/g, "");
this replace semicolons globally. if wish replace first instance remove g
first parameter.
Comments
Post a Comment