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.

Find the closest ancestor element that has a specific class

How can I find an element's ancestor that is closest up the tree that has a particular class, in pure …

javascript html dom
Can multiple different HTML elements have the same ID if they're different elements?

Can multiple HTML elements have the same ID if they're of different element types? Is a scenario like this valid? …

html dom
Getting the text from a drop-down box

This gets the value of whatever is selected in my dropdown menu. document.getElementById('newSkill').value I cannot however find …

javascript dom browser client-side
Get the selected option id with jQuery

I'm trying to use jQuery to make an ajax request based on a selected option. Is there a simple way …

jquery dom jquery-selectors
Best Practice: Access form elements by HTML id or name attribute?

As any seasoned JavaScript developer knows, there are many (too many) ways to do the same thing. For example, say …

javascript html forms dom
Can scripts be inserted with innerHTML?

I tried to load some scripts into a page using innerHTML on a <div>. It appears that the …

javascript html dom innerhtml
Appending HTML string to the DOM

How to append this HTML string var str = '<p>Just some <span>text</span&…

javascript html dom browser
Delaying a jquery script until everything else has loaded

I have a jquery script which I need to run only once everything else on the page, including some other …

javascript jquery dom
removing html element styles via javascript

I'm trying to replace an element's inline style tag value. The current element looks like this: `<tr class="row-even" …

javascript html dom styles
JavaScript Adding an ID attribute to another created Element

I have some code here that will do the following. The code creates an element "p" then I append it …

javascript html function dom setattribute