Top "Dom" questions

The Document Object Model(DOM) is a way to programmatically refer to the elements of a markup language like XML and HTML.

How to stop event propagation with inline onclick attribute?

Consider the following: <div onclick="alert('you clicked the header')" class="header"> <span onclick="alert('you clicked …

javascript html events dom
Parse an HTML string with JS

I searched for a solution but nothing was relevant, so here is my problem: I want to parse a string …

javascript html dom html-parsing
What is the "hasClass" function with plain JavaScript?

How do you do jQuery’s hasClass with plain ol’ JavaScript? For example, <body class="foo thatClass bar"> …

javascript dom
jQuery count child elements

I want to count the total number of <li> elements in <div id="selected"></div&…

javascript jquery dom
jQuery find events handlers registered with an object

I need to find which event handlers are registered over an object. For example: $("#el").click(function() {...}); $("#el").mouseover(function() {...}); $("#…

jquery events dom
Can I position an element fixed relative to parent?

I find that when I position an element fixed, it doesn't matter if the parent is positioned relative or not, …

css dom
Violation Long running JavaScript task took xx ms

Recently, I got this kind of warning, and this is my first time getting it: [Violation] Long running JavaScript task …

javascript google-chrome dom
How can I add a class to a DOM element in JavaScript?

How do I add a class for the div? var new_row = document.createElement('div');

javascript dom
JavaScript get element by name

Consider this function: function validate() { var acc = document.getElementsByName('acc').value; var pass = document.getElementsByName('pass').value; alert (acc); } And …

javascript html dom
How do I create a link using javascript?

I have a string for a title and a string for a link. I'm not sure how to put the …

javascript jquery html dom hyperlink