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!

0

1 Answer 1

0

You have to escape the asterisk:

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

because it is a special character in regular expressions.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you very much i forgot how to escape characters

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.