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

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -