dom

How does one access the Node Type Constants in IE

Hi, I have a node that I'm note sure is an element (from calling node.previousSibling). However I am having trouble finding out the cross browser javascript way to access the Node constants shown on the MDC. In all browsers but IE Node.ELEMENT_NODE is defined. I tried using a specific instance of node, e.g.: e=$("#element_id")[0]; ale...

jQuery doesn't select lineargradient object.

I am using jQuery 1.3.2, and I'm trying to select some elements in an svg DOM element. $('svg > defs > lineargradient') However for some reason it does not select it, I know that I can access other items in the <svg> element since I have successfully retrieved an $("svg > rect"). My SVG DOM looks like this: <svg width="975" height="...

Manipulate DOM elements before adding them to the document

Hey all, I was just wondering if there is a clean implementation to getting elements before appending them to the DOM. Example (w/ jQuery): var html = "<div class = 'test'><div class = 'innertest'>Hello!</div></div>"; var innerDiv = $(html).find('.innertest'); I feel like its not possible, but I'd like to see if there is any impl...

How to get 1st,2nd,3rd,4th,5th child element of a specific <div id="target"> with jQuery?

Is that clear? ...

How to find a URL from a content by PHP?

need a simply preg_match, which will find "c.aspx" (without quotes) in the content if it finds, it will return the whole url. As a example $content = '<div>[4]<a href="/m/c.aspx?mt=01_9310ba801f1255e02e411d8a7ed53ef95235165ee4fb0226f9644d439c11039f%7c8acc31aea5ad3998&amp;n=783622212">New message</a><br/>'; now it should preg_match "c....

How can I access iFrame elements with Javascript?

I have a webpage where there is a texarea within a iframe. I need to read the value of this textarea from its child page javascript. Presently by using window.parent.getelementbyID().value in the javascript, I am able to fetch values of all controls in the parent page except the textarea within the iframe. The frame id n frame name in my...

How can I read a HTML comment located outside of <html> using JavaScript?

I have a HTML comment outside of the DOM root node which I need to read: <html> ... other stuff </html> <!-- The comment I want to read --> Can I do this with JavaScript somehow? ...

jQuery slideUp bug?

I'm messing around with some jQuery stuff for a mockup and noticed some odd behavior. I'm hoping someone here can shed some light on it. This is all mockup / test code, so please excuse the sloppyness. So I have a table that I'm using in conjunction with the jQuery datatable plugin: http://www.datatables.net/ My table markup is as...

Javascript: getBoundingClientRect() for text nodes?

Hi, Is there a way to get the bounding rect of a text node? The getBoundingClientRect() method is defined on elements only, and the parent element is bigger then the actual text node. 10x! ...

how to fetch text nodes in DOM and PHP?

Hello I have the following code to retrieve all hyper links in an HTML document and my question is how to retrieve the text nodes inside every anchor tag (even if the text node is a child of a child like if the anchor node has a span node which has a text node)? <?PHP $content = " <html> ...

How to assign unique DOM element ID

My GWT application creates text areas, each of which must have an ID in order to be useful to a third-party JavaScript library. I know how to assign an ID to a GWT widget; I'm after a good way of generating those unique ID's. ...

XPath strangeness

I'm writing a script which reads and manipulates a KML (xml) document. Below is a snippet of the document I'm reading: <?xml version="1.0" encoding="UTF-8"?> <!-- Generated by Feature Manipulation Engine 2009 (Build 5658) --> <kml xmlns="http://earth.google.com/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"&gt; <Document> ...

Why does this Javascript DOM code only workin FF, but not IE?

//create an instance of the XML parser if (window.ActiveXObject) { //Checking if the browser is IE xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; //make sure doc is fully loaded xmlDoc.load(strPath) //load the file in the parser if (xmlDoc.parseError.errorCode != 0) { alert("Error #: ...

Element is not defined jQuery $(element).remove()

Hello SO: I have this javascript that adds a form field, along with a link to remove that field: var fieldCount = 0; function addField() { var name = 'file' + fieldCount; var row = 'row' + fieldCount; var str = '<p id="' + row + '"><label for="' + name + '">File to upload: <input type="file" name="' + name + '" id="' + name...

jQuery: Target all except ___?

I'm looking for a way to select all elements on a page, except those with a specified DOM location.. Here's an example of what I'd like to do: jQuery('*').except('.ignore').bind('click', function(e) { ... }); Is this possible in a "native jQuery" way? ...

Add/insert elements into Groovy MarkupBuilder object after initial creation

I understand how to create XML in Groovy using MarkupBuilder. How do you add/insert elements into a MarkupBuilder object after the initial creation? For example, start with: def builder = new MarkupBuilder(writer) def items = builder.items{ item(name: "book") } Which would produce: <items> <item name="book/> </it...

How to translate this pure javascript to jQuery?

document.getElementById('logbox').scrollTop = document.getElementById('logbox').scrollHeight; I tried $('#logbox').scrollTop but there is not this attribute. How to access DOM attribute through jQuery object? ...

Can I select DOM nodes with XPath attribute patterns using jQuery?

I've got a little problem: I don't know whether it is possible to select all DOM nodes with some attribute patterns using jQuery. For example, I need to select all nodes with id attribute set to a string starting with "_dom". I've found something like this: $("input[name^='news']").val("news here!"); but as far as I can see, this c...

How do I save data structures in android?

Hi. I want to store some data from structures like this: class Project { ChildA a; ChildB b; } class ChildA { ChildC c; ... } ... I have created data like: Projet x = new Project(); x.a = new ChildA(); x.a.c = new ChildC(); ... and I want to save it to an external file on the sdcard of my device so that other apps...

Prototype js get element with certain value

Hello, I am scraping some data and I want to get the the value of an element after a specific tag with value. It's a bold tag with value 'Types:'. <b>Types:</b> Once I get to that element I can use Prototype's Element.next() to get the data I want. How exactly do I do this? I have been fiddling with $$ but can't seem to get it righ...