dom

TinyMCE wrap element with another one (the new one)

I am creating plugin for TinyMCE and I need to wrap existing elem (node) with new one. For example, if I have paragraph: <p>hello</p> after command I need: <div id="someid"><p>hello</p></div> I tried below but it doesn;t wrap paragraphs, only theirs body, for example: tinyMCEPopup.editor.execCommand('mceReplaceContent',true,'<div...

Detecting width: auto in jQuery

I'm retrieving the width of elements using jQuery and would prefer it if I could have an indication of whether there was an explicit width (and height) specified. <div id="test"></div> <script type="text/javascript"> $(function() { alert($('#test').css('width')); }); </script> This will alert the implicit width of the div in terms of ...

onclick handler not firing for checkbox created with document.createElement

Hello all. I am going insane trying to figure out why this is not working. I am creating a checkbox dynamically with JS to enable/disable a text field (also created dynamically). Code is pretty simple: var text = $(document.createElement("input")); text.type = "text"; container.appendChild(text); ... var check = $(document.createEle...

How to get values of child nodes with QDomDocument?

A recieve a string like this: <invoke name="CanClose" returntype="xml"> <arguments> <string># 998.40</string> <number>49920</number> </arguments> </invoke> I'd like to use QDomDocument to get the values of arguments' child nodes by their index (I would like to extract the strings "# 998.40" and "49920" in the examp...

jQuery - Getting the checked values of any set of checkboxes.

I would like to determine the most efficient way (using jquery, or dom) to get the value of a set of checkboxes if you have one of them. This should be generic when the input checkbox is part of a form. However, is this x-browser safe, how to do this more efficiently, and what if the checkbox is not part of a form? function (domCheckbo...

How can I tell if a page has jumped to the anchor (#) in javascript?

I have some javascript that can appear on many different pages. Sometimes those pages have been accessed via a URL containing an anchor reference (#comment-100, for instance). In those cases I want the javascript to delay executing until after the window has jumped. Right now I'm just using a delay but that's pretty hackish and obviou...

JQuery html() vs. innerHTML

Hi, Please tell me, Can I rely completely upon jquery html() method that it'll perform like innerHTML? is there any difference between innerHTML and jquery html() method? and if these both do the same work can I used jquery html() method in place of innerHTML? My problem is: I am working on already designed pages, the pages contains ta...

Finding highest z-index of all elements

I need to implement an alert-type modal popup that appears with a dimmed background. The problem is, we may have other elements on the page being showed that are also modals with z-indexes above default. How do I determine the appropriate z-index that makes a given element the highest-layered element? (jQuery is fine.) ...

What is the equivalent for org.apache.xml.serialize.OutputFormat in DOM Level 3

We recently moved to xercesImpl-2.10.0.jar from previous version and some of our old usages are showing as deprecated. Can I know the latest usage for them FileOutputStream fos = new FileOutputStream(vAdjustmentFile + "_merged"); **OutputFormat** of = new OutputFormat("XML", "ISO-8859-1", true); ...

How to determine if assets are downloading on a page?

I am attempting to observe the performance of a flash application on the client side using JavaScript. The main thing I'm interested in is if the flash application has completed downloading all of the assets it needs. Is there a way to determine if assets are still being downloaded by the browser regardless of the container downloading...

Should I use Table.cells[]?

Hi there. I'm currently trying to write some javascript to loop through the elements in a table, but was wondering what the best practise was. I could just call .cells[] on my table object to get all of the cells in the table, but the W3Schools page says that this is not a W3C standard - should I avoid it then? The other option is to us...

IE8 Standards mode JQuery illogic

I have a JQuery (using JQuery 1.4.2) problem that exhibits only in IE8 in standards mode, on one specific DOM element but not on other nearly identical dom ellements. The best example of why it makes no sense is below: $('span.error:visible')[0].style.display The above piece of code returns "none" which unless i am having some sort o...

onBlur event overriding jQuery UI events

I have a textbox that is wired up using jQuery UI 1.8.4 autocomplete. I have the select event wired up so when the user chooses an item from the list it calls another javascript function that issues an ajax request to save the data and update an XML document. On the same textbox there is an onBlur event so that if the user manually typ...

How can I find out the namespace of an element in PHP DOM?

This sounds like a pretty easy question to answer but I haven't been able to get it to work. I'm running PHP 5.2.6. I have a DOM element (the root element) which, when I go to $element->saveXML(), it outputs an xmlns attribute: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"...

Using jquery remove() with id passed by variable. Possible?

This is the function function deleteItem(id) { $.post("_asyncpage.php", {id:id}, function (result) { if (result == true) { $('#'+id).remove(); } }, "json"); } So, to explain, the function receive an id, send to a page that execute random stuff on a db and return true...

How to serialize browser HTML DOM to XML?

I need to serialize browser parsed HTML DOM to well-format XML. In firefox (gecko), this works: // serialize body to well-format XML. var xml = new XMLSerializer().serializeToString(document.body); But in webkit, result is equivalent to document.body.outerHTML, not well-format XML (for example: <br> won't become <br />) How to seria...

How to get the computed width of an element's border?

How can I get the computed border width of a HTML element in Javascript? (Independent of where and how the border is specified.) ...

Find the DOM element containing a specific offset with jQuery or plain JavaScript

Hi, I am paging an HTML page. In order to compute the page break offsets more efficiently, I was wondering if it is possible to get the element containing a certain coordinate offset from the beginning of the page. Thanks a lot in advance for your help, Cheers! ...

javascript-canvas Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

OK, I have two versions of my code. The first appears to work (mostly) and the 2nd gives me the Uncaught Error in the topic name. defs: var VID_WID = 640; var VID_HIGH = 360; var OUT_WID = 480; var OUT_HIGH = 320; var NUM_WID = 3; var NUM_HIGH = 3; var TILE_WIDTH = VID_WID / NUM_WID; var TILE_HEIGHT = VID_HIGH / NUM_HIGH; var OUT_WI...

Scope of THIS keyword in Function?

Should 'this' in the following code not still refer to the DOM object selected by the MooTools selector? $$('div').addEvent('click', function() { var click1 = function(){$(this).setStyle('background', 'red');} click1(); }); ...