removeClass(element: HTMLElement, value: String);
element. DOM element with the CSS class to delete.
value. Name of CSS class.
The removeClass method removes CSS class from a specified element.
This method clears name of CSS class in the className field of a specified DOM element.
To execute the example, add a link to PP.js scenario file to HTML page. Let us create a DOM tree based on a specified string with HTML markup, and remove the CSS class plainText for this tree:
// Determine markup string
var markup = "<div class='plainText'>12</div>";
// Transform markup to DOM node
var dom = PP.htmlToDOM(markup, False);
console.log("Source element class: «" + dom.className + "»");
// Remove CSS class from this node
PP.removeClass(dom, dom.className);
console.log("Element class after clearing: «" + dom.className + "»");
After example execution the browser console displays name of CSS class of the created DOM element before and after this class was cleared:
Class of initial element: plainText
Element class after clearing:
See also: