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 remove all CSS classes using jQuery/JavaScript?

Instead of individually calling $("#item").removeClass() for every single class an element might have, is there a single function which …

javascript jquery dom
How to show Page Loading div until the page has finished loading?

I have a section on our website that loads quite slowly as it's doing some intensive calls. Any idea how …

javascript jquery html dom loader
How can I tell if a DOM element is visible in the current viewport?

Is there an efficient way to tell if a DOM element (in an HTML document) is currently visible (appears in …

javascript html firefox dom browser
How do I replace text inside a div element?

I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have …

javascript html dom
Check if option is selected with jQuery, if not select a default

Using jQuery, how do you check if there is an option selected in a select menu, and if not, assign …

javascript jquery forms dom html-select
Best way to get child nodes

I was wondering, JavaScript offers a variety of methods to get the first child element from any element, but which …

javascript dom elements children
Check if element is visible in DOM

Is there any way that I can check if an element is visible in pure JS (no jQuery) ? So, for …

javascript dom
How to pass arguments to addEventListener listener function?

The situation is somewhat like- var someVar = some_other_function(); someObj.addEventListener("click", function(){ some_function(someVar); }, false); The problem …

javascript dom addeventlistener
How to resolve the C:\fakepath?

<input type="file" id="file-id" name="file_name" onchange="theimage();"> This is my upload button. <input type="…

javascript html dom file-upload
How to get element by class name?

Using JavaScript, we can get element by id using following syntax: var x=document.getElementById("by_id"); I tried following …

javascript dom