Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InnerHTML horizontal row problem

Status
Not open for further replies.

makamo66

Technical User
Jul 24, 2010
13
US
I want to add a horizontal row after the user clicks on Completed. This javascript isn't working:

function myFunction() {
document.getElementById("green-hr").innerHTML = "<b>Completed</b><br /><hr />";
}

<b onclick="myFunction()" id="green-hr">Completed</b>

How to fix it?
 
Are you getting any error? Use your browser's console to check for JS errors.

Your code works for me as is.

Your code will change the contents of of your <b> element to have a line break <br> and a horizontal rule <hr>

----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
I checked using regular HTML and my hr doesn't show up unless I add a line-height of 2 px so that was the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top