dom

How to get the first child id inside the div using JQuery

Hi, How to get the first child id inside the div using JQuery. Sample code: <div id='id1'><a id='a1' /> <a id='a2' /> <a id='a3' /> </div> I want to get the id a1. I have tried $('#id1 a:first-child').html() to get the text. How to get the id? Geetha ...

Crossbrowser JavaScript + DOM documentation

I'm already aware of some browser-specific DOM documentation out there (Gecko DOM Reference for Firefox, MSDN for Internet Explorer and, of course, the ECMA and W3C specs) but I wonder if someone has compiled a good API reference that covers all common browsers (Firefox, Internet Explorer, Opera, Safari, Chrome...). The compatibility ta...

dojo/dijit ContentPane setting content

I am trying append some XML retrieved via a dojo.XHRGet to a dijit.layout.ContentPane. Everything works ok in Firefox (3.6) but in Chrome, I only get back 'undefined' in the particular ContentPane. My code looks something like this: var cp = dijit.byId("mapDetailsPane"); cp.destroyDescendants(); // there are some existing Widgets/cont...

What exactly is DOM Load time?

What exactly is DOM Load time? Is it time to just get complete html from server or does it include the rendering time? Please explain. ...

Why would html source not change when the DOM is updated dynamically

I had posted one question earlier http://stackoverflow.com/questions/2381621/jquery-inconsistency-in-setting-readonly-attribute-in-ie-8-and-ff-3-5-8 and was quite happy with the answer. But I did notice that if you update (any??) DOM elements dynamically, then view source (using browser's view source) I find the the updated DOM element ...

is there a way to add a variable/property to a DOM element (eg, an element returned by a jQuery selector)

Hi there, I am looking for an alternative to using an object/variable in global scope -- I would like to associate key/value pairs with specific DOM elements (eg, a DIV), so that I can use them as input for logic that processes other elements (eg, child elements of said DIV). I tried something naive like: $('[foo=bar]').key='value' , a...

What is the best way to observe the scroll over an element with overflow set?

It's simple to observe the documents scroll event but I can't seem to find anything relating to the scroll of any other element with css property overflow being set? To get around this myself i've been observing mousemove which only fires while you hold down on the scrollbar but this would need to be teamed with a mouse wheel observe al...

Move mouse cursor using javascript in Chrome or Firefox using any method (Plugin, GreaseMonkey?)

Hi, I have need to move the mouse cursor position in the browser, I can use any method as long as its in Google Chrome or Firefox, one or the other. In the best case, I would like to control the mouse position with javascript. Any easy way to do this? Thanks! Phil ...

Determine if a dijit's DOM has finished loading

Is there a way to query a dojo dijit to tell if the dijit's DOM has finished loading? ...

Undefined id property on td object when accessed through rows/cells collection

What is it I am doing wrong here: When I try to use the getttribute['id'] method on a TableCell object that I get from iterating through a tables rows/cells it returns undefined: var rows = document.getElementById["table"].rows; var cells; for(var i=0; i < rows.length; i++) { cells = rows[i].cells for(var j=0; j < cells.length; j++) ...

Problem with background color on li tag

I am setting background color of an li element by the code below : $('#li123').animate({ backgroundColor: color}, 'slow'); It works fine but the color spans whole length of li. What do I do if I want it to span the text contained in the li only. ...

javascript removeChild(this) from input[type="submit"] onclick breaks future use of form.submit() under firefox

I have come across some strange behaviour, and I'm assuming a bug in firefox, when removing a input submit element from the DOM from within the click event. The following code reproduces the issue: <form name="test_form"> <input type="submit" value="remove me" onclick="this.parentNode.removeChild(this);" /> <input type="submit" value="...

html tag in childNodes (how can i get NodesValue)

<p title="The test paragraph">This is a sample of some <b>HTML you might<br>have</b> in your document</p> txt=document.getElementsByTagName("p")[0].childNodes[0].nodeValue; alert("<p>The text from the intro paragraph: " + txt + "</p>"); it doesn't work. How can I get the childNodes.nodevalue "This is a sample of some HTML you might ...

using jquery to insert content into the dom on page load

I have a website which is loading thumbnails and then using the jQuery pluggin Masonry to shuffle them into a grid. See http://www.kalpaitch.com for an example of what is happening at the moment. My concern is the delay between loading all the content and the masonry call which is triggered on page .load(). What would be the best approa...

inline javascript are interrupting the load of the html

I want the html are fully loaded then execute the inline javascript because this script stops the load of the html document. To try to solve this problem I put the inline javascript code at the end inside a div then i use the jquery .append method $("#subhimedia").appendTo("#himedia"); This works and appends the inline js that i...

Browser EventListenerList Implementation

Are there any browsers that implement the DOM3 EventListenerList interface? http://www.w3.org/TR/2001/WD-DOM-Level-3-Events-20010823/events.html#Events-EventListenerList ...

HTML chunk appears in DOM only when Firebug is running

I've been banging my head against this for the past few hours. I'm building an HTML chunk with Javascript and appending it to the page's DOM. Problem is this works only if Firebug is running and disabling Firebug doesn't help. When Firebug isn't running the code gets generated but not appended to the DOM (it's not that it's invisible o...

List of All Background Images in DOM

What's the best way to find all of the background images on a given page using javascript? The ideal end result would be an array of all of the url's. ...

Elegant way to import XHTML nodes from xhr.responseXML into HTML document in IE?

While navigating through a site, I'm dynamically loading pages via Ajax and then only updating the elements of the page that are changed, such as the navigation state and main content area. This is similar to Lala. I am serving the site as XHTML in order to be able to have access to xhr.responseXML which I then traverse in parallel with ...

Getting elements children with certain tag jQuery

I'm trying to get all the input elements from a certain form from jQuery by providing only the name of the form and only knowing that those wanted fields are input elements. Let's say: <form action='#' id='formId'> <input id='name' /> <input id='surname'/> </form> How do I access them individually with jQuery? I tried something like ...