JavaScript Examples

Using JS to FILL IN a blank space

We will use 'document.getElementById('___').innerHTML = 'Something';
This will FILL IN the contents.
e.g.

 

Using JS to REPLACE a section

We will use 'document.getElementById('___').innerHTML = 'Something';
This will Replace the contents.
e.g.

This contents will be replaced.

 

Using JS to change ELEMENTS of a P tag

We will use 'document.getElementById('___').style.something;
This will Change the contents styling.
e.g.

This will be Changed.

 

Using JS to HIDE and SHOW content

We will use 'document.getElementById('___').style.display="none or block";
This will Hide or Show the contents styling.
e.g.

This will be hidden or revealed.

 

This is VERY dangerous - but could be quite useful!

Click the button below to see what happens!