0

how do i replace the asterisks with a blank ("") in the innerhtml using javascript? i have tried this.

document.getElementById("lab").innerHTML = document.getElementById("lab").innerHTML.replace(/*/g, '');

and i also tried doing the asterisk itself but it gets commented.. searched everywhere i can't seem to find ways to remove the appended in innerhtml aside from replacing it with a blank.. are there any other options? i also tried searching for ways to use replace and other options. for added info i am using this for the validation of a form thanks in advance!

Andre malupet
  • 91
  • 3
  • 12

1 Answers1

0

You have to escape the asterisk:

.....replace(/\*/g, "")

because it is a special character in regular expressions.

georg
  • 211,518
  • 52
  • 313
  • 390