dom

Can't select HTML5 element's children in IE8 with jQuery selector

I found some posts with similar issues, but this is something different. I upgraded from jQuery 1.4 to 1.4.2 after I read another post, but the problem still presents itself. I also tried running IE 8 in compatibility mode and nothing seemed to work. Of course, it works perfectly well in Chrome. Here's the markup: <section class="pleas...

Using JavaScript insertBefore() to insert before a TextNode?

I have HTML like the following: <div id="move-me"> <a href="#">I'm a link</a> </div> <div id="new-parent"> Some plain text. </div> I'm trying to write JavaScript that will move the entire #move-me div inside the #new-parent div, above the text, like so: <div id="new-parent"> <div id="move-me"> <a href="#">I'm a l...

Is there a standard for Javascript/jQuery <img /> that haven't yet been placed in the document?

Is there a specification for how browsers handle image loading if the image tag is just one of those diembodied Javascript elements that haven't been inserted into the document? An example: $('<img src="/path/to/image.jpg" />') Is there a specification that tells the image to load? I ask because I am interested in the following implem...

How to insert a piece of code programmatically using jQuery?

Hi guys, I'm learning jQuery and I'd like to use it to solve an old problem that I get. I'd like to use jQuery to add a piece of HTML code programmatically. What I need to do is: create a jQuery function that "parses" all elements/objects that are inside a div. When my function get a img object, then I'd like to put the img inside anoth...

Remove parent of a parent with jQuery and DOM

My html looks like this : <li> <div> <p class="delete"> <a href="#">X</a> </p> </div> <div class="friend-avatar"> <img src="" /> </div> </li> After clicking anchor tag in 'delete' paragraph I'm showing a popup (using jquery-alert) and if user selects 'Yes' I would like the whole li c...

Cloning in-memory image in JavaScript /jQuery

This is probably a really simple one but I couldn't find the answer. I have the following JavaScript/jQuery code where I am trying to create loading messages: // preload an image to use for dynamic loading icon whenever requested $(document).ready(function() { var loadingIcon = document.createElement('img'); loadingIcon.src = '...

How to insert an element at selected position in HTML document?

I want to insert an element(span,div etc) at the position determined by user selection of text in the document. I was able to get the element on which selection is made. But I am not able to get the exact position where the selection is made. For example: <span>this is testing string for testing purpose</span> In this, lets assume t...

How to store data of complex types for use in Javascript?

This is a reoccurring theme: either AJAX causes data to be requested from the server and then the data is shown to the user or the page is pre-populated (ie. rendered) with data that has some kind of interaction with Javascript. Here are couple of possibilities I see how to store and manipulate the (complex) data: Store the data simpl...

Append custom attributes to a DOM node

Possible Duplicate: Can I just make up attributes on my HTML tags? Hi, I am not sure if what I am asking is even possible, but I'd like to be able to add a custom (nonrendered) propery to an existing HTML DOM node. For example, if I have a simple DOM as below: <body> <p> <span id="aSpan"></span> </p> </body> .. I'd l...

Flash application losing state after displaced to another div by JavaScript

Guys, I've a simple flash application that does counting on button click. I load it in a page and a javaScript code does some DOM manipulation to move it from one div tag to another. Problem: the state of the count is not preserved as the swf node is moved from one node to another. What I did: 1. I simply get the node using javascript...

PHP DOMDocument: How to get direct node childrens

Hi, I've got the following: http://pastie.org/1066861 I've got a Javascript function, that tells me to delete a given node from the parent, let's assume position 1 ( from 0 or 1, since we've got two child nodes on parent ), When doing $parent->getElementsByTagName and trying to remove the the $child->item( 1 ), I notice that PHP GetEle...

Calculating text selection offsets in nest elements in Javascript

The Problem I am trying to figure out the offset of a selection from a particular node with javascript. Say I have the following HTML <p>Hi there. This <strong>is blowing my mind</strong> with difficulty.</p> If I select from blowing to difficulty, it gives me the offset from the #text node inside of the <strong>. I need the string ...

How do I select the first H1 element in a TD?

I am (stuck) using Prototype 1.3.1 and I'm having a hard time moving from jQuery to the older version of this library. Unfortunately, the extensions I'm writing are for a vendor-provided system to which we can not update. So, no moving to a newer version. I'm having trouble finding out how to do things without the modern CSS selectors...

How do I capture mouseover events on dynamically-added input HTML elements using jQuery?

I am dynamically adding input elements to a table with the id of inputDataElements. These input elements have the name deleteAction: function renderInputDataRows(inputData) { ...

What kind of HTML element is this? quotes?

hi all, I'm checking out the HTML rendering of a page: http://gothamist.com/2010/07/18/wikileaks_founder_no-show_at_nyc_ha.php if you look at this image you can see when I look at the DOM there are odd character breaks with quotes by " As a commenter " http://img153.imageshack.us/f/screenshot20100730at840.png/ Any idea what those are...

PHP Generated Inputs and Standard DOM Inputs display differently.

As you can see the following produces the exact same configuration of Select:Text:Image. However whatever the HELL I do I cannot get them to display the same without different CSS which I do not want to do. I have used CSS resets, Identical CSS, removed attributes etc. Any idea what is making them act so stupidly? It is really starting t...

What sort of object does the appendChild() function belong to?

What object does the appendChild() function belong to? ...

jQuery: Applying effects to a textbox contents

I am trying to fade out and fade in the text inside a textbox. Is this even possible with jQuery or javascript? Thank you. ...

Load timeout for Javascript

Consider the following document <html> <body> This is some content <script type="text/javascript" src="verySlowToRespond.js"></script> This is some more content </body> </html> I'd like first to check my assumption that it is unsafe for the browser to parse beyond the script tag until the script has loa...

jQuery parents (nested divs) change class

I'm trying to learn jQuery I want that, when I hover a children, he changes (rose in the image) the class of parents (XI). I believe that must be something like that $(this).parent().addClass("XI"); You can copy and save it near jQuery <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-str...