set the html of an element javascript

this will set the innerhtml value of an element

HTML

<div id='mydiv'>Hello</div>
<p><button onclick='set_html_val();' class='btn btn-primary'>Set Value!</button></p>

Javascript

function set_html_val() {
	document.getElementById("mydiv").innerHTML = "World! :P";
}
Hello

Other Items in javascript

No Items Found.

Add Comment
Type in a Nick Name here
 
Page Views

This page has been viewed 174 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

โค๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ•น

Random Quote
Our brains are wired to find things we are looking for - if your always cynical or waiting for things to go wrong, then your life will reflect that. On the other hand, having a positive outlook on life will bring you joy and provide you with inspiration when you least expect it โ˜€๏ธ๐Ÿ‰๐ŸŒด
Unknown