-->
Free Bitcoin Faucet - Claim $200 Every Hour - Free BTC

How to Change or Replace Element's Class with JavaScript (no jQuery)

- 7:07:00 AM
Free Bitcoin Faucet - Claim $200 Every Hour - Free BTC
One Javascript capabilities is able to create more interactive Web-based applications. Scripting languages have been able to manipulate even manipulating css html element in a Web document. In this article, I will share how to Change or Replace Element's Class with JavaScript (no jQuery) in manipulating elements in the css class.

This way so simple we only need a few changes to the HTML DOM setAttribute () method, and then determine the target div class that will in the change. okay see in the example this below.

Changing the class attribute with a value of "replace-or-change-div" for <div class="divtarget"> element:
document.getElementsByClassName ("divtarget") [0] .setAttribute ("class", "replace-or-change-div");

Before setting the attribute:
Hello World
After setting the attribute:
Hello World

Complete code.


Test Script Via http://codepen.io/bloggerkan/pen/zBQoaj


Advertisement Free Bitcoin Faucet - Claim $200 Every Hour - Free BTC
 

Start typing and press Enter to search