Tag: dom

DOM not responding to jquery evers after load function

I have a simple page that loads content dynamically. I use the jQuery load function to append content to a div. The load function loads content from another file. The problem I am having is that after the content loads, the jQuery functions I have built are not responding to click events. To prove that […]

How to remove a div's content with jQuery

How would I go about removing the content inside a div tag with the class content. <div class=”content”></div> I would imagine it would be something like: $(.content).remove Separately, how would I go about adding a string of text inside that same div?

Determine what Javascript function is called when you click an element

Is there a way to determine what Javascript function is called when you click on an item in a HTML page that has JS binded to the click event (added using jQuery, not the onClick tag attribute) ? Obviously, the website is not mine and the code is minified.

How to delete all text inside a DOM element

I have a div that looks like this. <div class=”main”> <div class=”slide”></div> <div class=”thumbs”> Text 1 <img src=”https://cdn1.iconfinder.com/data/icons/flat-business-icons/128/stack-128.png”/> <div></div> <p>Text 2</p> <div> <p>Text 3</p> <div><p>Text 4</p></div> </div> </div> </div> And I want to delete all text inside the div with the class thumbs. I tried this, but unfortunately, it only delete “Text 1” and not […]

How can I get a reference to a node directly after it is appended?

I have a situation where I’m appending a node inside an element and would like a reference to it right away. At the moment I do something along these lines: var children = $(“#elem”).append(“<p>hello</p>”).children(); var current = children[children.length -1] Can this be done more cleanly with jQuery? I know, I can write a helper function, […]

Geting reference to many elements having the same id using Javascript

Suppose to have the following: <div> <div id=”element”></div> <div id=”element”></div> <div id=”element”></div> <div id=”element”></div> <div id=”element”></div> <div id=”element”></div> <div id=”element”></div> </div> Ok. This html piece is placed somewhere in the code… I must collect all tags having the element id. How can I achieve this in javascript? getElementById allows me to retrieve only one element… […]

does innerHTML work with XML Elements?

According to JavaScript: The Definitive Guide: “Despite its name, innerHTML can be used with XML elements as well as HTML elements”. However, when I actually attempt to access the innerHTML property of an XML Element object, undefined is returned: var xml = $.ajax({url: “test.xml”, async: false}).responseXML.documentElement; console.log(xml.innerHTML); // displays “undefined” in console log What is […]

html5, what is isContentEditable?

chrome supports the isContentEditable property (lists it in the “Inspect Element”), but reports false for INPUT, FORM – actually, everything. too me, for example, seems that INPUT, non-readonly, should be true. does anybody know what’s going on?

How do I “refresh” element in DOM?

I’ve got an empty DIV element in which I append images by using function createElement(“img”) and append them with appendChild. So now I’ve got DIV element full of images. I would like to use one button to clean this DIV and add new images in it simultaneously. Thanks for your help

What is the implementation of GetElementByID()?

Can somebody please explain to me the internal implementation of HTML getElementById() method ? Is it traversing whole DOM tree to find the specified element or is it intelligent enough to look for near-by elements first ? Thank you