dom

What's up with document.domConfig on Firefox?

I was iterating over properties of document when I ran into an interesting phenomena in Firefox, document claims to support the property domConfig although MDC says it isn't implemented but when I try to retrieve the property I get an exception: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS...

Reload DOM after injecting form elements?

Hi, I'm trying to put together some jQuery code that will add form elements (input checkboxes) to a form, once the user performs a certain action. Later on the user can then submit this form. I'm entirely new to jQuery, but I've managed to put together some code that almost works. Here's what I've got: $("#someDivID").load("myPage.asp...

Ajax with multiple form inputs

Hi Guys, I am working on a new system and am stuck at a point with jquery + ajax and getting it work work correctly with the other things happening on the page. Basically the page is to submit a quote and on the page you can add as many quote items as you want. When someone clicks on new item it runs the below code wich gets the value...

jQuery - returning $(this) DOM Element

Hello, i'm using DD_Belated.png to save all IE6 users from seeing the madness of unsupported png. However, this great script takes either selector or DOM Element as parameter to it's only function to do it's magic and return working PNG to IE6. Me, being lazy programmer, did something like this: $("img[src$=png], #search").each ( fu...

Javascript focused control

Is there any way I can determine the currently focused control on a web page? I wish to save the focused control before my ajax callback and restore it afterwards. Can this be easily determined? Thanks, AJ ...

Iterating over element attributes with jQuery

I know individual attributes can be retrieved with the attr() method, but I'm trying to iterate over all of the attributes for an element. For context, I'm using jQuery on some XML... <items> <item id="id123" name="Fizz" value="Buzz" type="xyz"> <subitem name="foo"> <subitem name="bar"> </item> <item id="id456" name="Bizz...

JavaScript objects and persistence through dialogs

Hi, Rather simple question here. I want to create an JS object that has a property, say, name. I want to create that object and be able to use it throughout my page. For example, what I have now doesn't work: var item = new Object(); function makeItem(title) { item.name = title; } Inside a modal dialog: makeItem("test"); alert(i...

JQuery 101 - Changing text value

I have a link to hide/display some text: <a href="javascript:void(0);" id="toggle_status_history">show/hide history<a/> The corresponding JavaScript looks like this: $(document).ready(function() { $('#toggle_status_history').click(function() { if ($('#status_history').is(":hidden")) { $('#status_history').slideDown("fast"...

IE7 default form method is "GET". How can I tell if it's user-entered or default?

If a user creates a form without a method attribute, it seems like most browsers will handle this at the time of form submission. So upon inspection of the form element after the DOM is ready, you can see that there is no "method" attr of the form element object. IE7, however, apparently sets a default method value of "GET" on all forms...

Using ASP/VB to get value of a node attribute

Hello all. I have the following XML schema: <lyrics> <response code="0">SUCCESS</response> <searchResults> <result id="120745" hid="gXTQx5ywE0M=" exactMatch="true"> <title>Opera Singer</title> <artist> <name>Cake</name> </artist> </re...

Wrap text and elements in another element using jQuery

I have a page which essentially looks like this: <div id="foo"> <a>One</a>, <a>Two</a>, <a>Three</a>, <a>Four</a> </div> Extra attributes removed for the sake of brevity. There could be any number of links inside the div. What I want to do is to hide all the links after the n th one and add a "Show the rest" link. Basically, for ...

Detecting Hebrew words in document via JavaScript

Hi guys, I'm a mostly-newbie when it comes to web development (though not to programming in general) so pardon any incorrect terminology. I want to build a script that, when added to an HTML page, detects each Hebrew word in the page and transforms that word into an HTML element, e.g. into a hyperlink with title. So, the following: <...

Replacing script src using jquery not executed

Hi, great people, I would like to replace the source url of the script on the fly to speed up dev stages only, so no actual production usage. This kind of replacement works well with css or images. But have hard time to make it work with javascript src. The script seems not executed, although loaded via src. Here is what I have done. ...

Which Frameworks Abstract Away the DOM?

A recent twitter post I've seen made some comment to the effect of "the DOM is Javascript's ugly date". I tend to think that the DOM is a horrible way to define user interfaces and certainly in the context of multiple browsers with their quirks I find trying to build sophisticated web apps with complex view layouts to be a completely fr...

Add html string to DOM as element

Is there anyway to create a string and add to the DOM? And having Javascript to understand the elements in the string? I tried the below and 4th line gives error: var bmdiv = document.createElement('div'); bmdiv.setAttribute('id', 'myDiv'); var str = "<b>aa</b>"; bmdiv.innerHTML(str); I need to add several tags in str to the DIV myDiv...

php->xml using DOM, prints all on the same line, server config or intended?

I'm using php DOM to build an XML file of data, it works fine but it all outputs on one line, like so: <property><something><somethingelse>dfs</somethingelse></something></property> However in all examples I've found it's outputting properly, like so: <property> <something> <somethingelse> dfs </something...

NodeIterator vs Xpath for DOM iterating/finding in Javascript

Which is better to use when iterating over DOM elements or finding a a set of DOM elements. is Xpath faster? ...

How can I add attributes to the root node of an XML doc in javascript

Hi Everyone, I am using the sarissa javascript library to create xml on the client in a web application. My question is how can I add attributes to the root node? I am really trying to pass a small xml string to the server like basically a 1 liner of XML. I tried this and it doesn't work. oDomDoc does not support the "setAttributeNode" ...

PHP DOM Get <option> Tag That Is Selected

So let's say the HTML looks something like this: <select name="some_name"> <option value="1">1</option> <option value="2">2</option> <option value="3" selected="selected">3</option> <option value="4">4</option> </select> I need to extract the option tag with attribute selected="selected" from there. How can I do that? ...

CSS Selector picker/finder?

Anyone know of a tool/Firefox Plugin that would allow me to click on a DOM object in a page and give me the CSS inheritances that Is needed to style that element? So if there are a bunch of nested elements ol li ol li etc... what should my CSS look like to style said element? ...