dom

Way to override where jQuery-UI dialog places things in markup?

I am trying to get a simple jQuery UI dialog to work in an ASP.Net project. I have some buttons inside the dialog's <div>, but they weren't posting back. Upon closer inspection, for whatever reason when making the <div> a panel it moves it in the DOM so that it is the last tag before </body>. This would all be fine and dandy except for i...

hide radio button onlick javascript

i am trying to hide radio button values when you click it. i can do this if in a non dynamic way like this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript"> <!-- function showDiv( id ) { document.all.textBox01.style.visibility = 'hidden'; d...

Accessing the content of other tabs in browser

Hi, I am using mozilla firefox and am trying to figure out a way to access the content of other tabs in the same window with the help of javascript and DOM (am open to other techniques if exist). Would someone help me? E.g. I want to run a javascript in tab1 which can find the title of some other tab. Basically I need this so that I can...

jQuery: getting next node (also text nodes)

Hello, I've a jQuery object and I shall retrieve the next sibling node, which may be a text node. For example: <div id="test">some text<br/>other text</div> var test = $("#test"); var br = $("br", test); alert(br.next().length); // No next ELEMENTS alert(br.get(0).nextSibling.nodeValue); // "other text" alert(br.get(0).nextSibling.next...

Array to XML in Php (using DOM)

Hi everybody, i just have a php array with number that i've "explode" to separate itens, $arr = array($_POST["fname"]); $arr = explode(',', $_POST['fname']); $parentesis; $parentesis2; for ($i = 0; $i < sizeof($arr); $i+=2){ `$parentesis = substr($arr[$i], 1);` `$parentesis2 = substr($arr[$i+1], 0,-1);` actually arays...

getRangeAt() -- error if no text is selected

I use this simple Javascript code to retrieve text that was selected on a webpage: var userselection = window.getSelection(); //user selection will be a Selection-Object var rangeObject = userselection.getRangeAt(0); The code works fine if text is selected. If I just click in the text that could be selected I get a range object too, ...

javascript page source help

Currently I am writing a system for a user that on filling in a form it creates a template for a HTML email that will be able to use with their CRM system, the issue is that you user is a bit docile and for the live of them cannot understand how to view the source of the page so they can copy and paste the template code into their CRM, w...

JavaScript - Get all but last item in array

This is my code: function insert(){ var loc_array = document.location.href.split('/'); var linkElement = document.getElementById("waBackButton"); var linkElementLink = document.getElementById("waBackButtonlnk"); linkElement.innerHTML=loc_array[loc_array.length-2]; linkElementLink.href = loc_array[loc_array.length]; } I wan...

Javascript - Replace '%20' spaces

var loc_array = document.location.href.split('/'); var linkElement = document.getElementById("waBackButton"); var newT = document.createTextNode(loc_array[loc_array.length-2]); var repl = newT.replace('%20',' '); linkElement.appendChild(repl); Anyone know why this causes the text to not show up? ...

Preferred DOM library for parsing html pages with node.js?

I'm looking for libraries that parse html pages ( with some leniency, not strict xml parsers ). Can anyone recommend any? Edit: Came across jsdom ...

how to use $.makeArray() with jQuery

Can anyone explain me how to do this, jquery's api is really lacking on this. What is wrong in the following code? var arr = $(value).filter(function() { return $(this).is("TD"); } ).html(); alert(arr[1]); I just want to grab the innerHTML/text of the td and put it in an array ...

JavaScript Back Button Failure

So I thought this script was pretty straight forward: <a id="BackButtonlnk" href="#" class="white" onClick="history.go(-1)"></a> When I click it it briefly shows the previous page but just looks like it refreshes and you never end up at the previous page. ...

Javascript: Get last item in an array.

Here is my code so far: var linkElement = document.getElementById("BackButton"); var loc_array = document.location.href.split('/'); var newT = document.createTextNode(unescape(capWords(loc_array[loc_array.length-2]))); linkElement.appendChild(newT); Currently it takes the second to last item in the array from the URL. However I want ...

Contents of a Div formatting differently when built through jQuery

I have the following DOM structure: <div id="module-main"> <div id="module-crumbs"> <h4>Hello</h4> </div> </div> When I place that in a document and view it, it works fine. But if I build it from jQuery like so: $('#module-main').append($('<div id=\"module-crumbs\" />')); $('#module-crumbs').append($('<h4/>').html('Hello')); In...

self property in javascript?

I read here that "self Refers to the current window or form". Self does not seem to refer to the current form in this case: <form><input type="text" onkeyup="alert(self.foo.value)" name="foo"></form> However in this case it works (referring to the window): <form><input type="text" onkeyup="alert(self.document.forms[0].foo.value)" ...

What's the difference between the document and the DOM?

Hi, So I came across a piece about the difference between jQuery's bind() and live() - http://msdn.microsoft.com/en-gb/scriptjunkie/ee730275.aspx - (Live and Let Die section) The bind function registers the event handlers with the actual DOM elements that were selected, but the live function registers the event handlers on the docu...

HTML5/DOM2/Javascript Visual Studio 2008

I've found this link- http://blogs.msdn.com/b/webdevtools/archive/2009/11/18/html-5-intellisense-and-validation-schema-for-visual-studio-2008-and-visual-web-developer.aspx to update the tags for HTML5, which isn't a whole lot of use when I'm using just one or two new tags. Is there any way to get Visual Studio 2008 to recognise the new J...

Detect changes in the DOM

I want to execute a function when some div or input are added to the html. Is this possible? For example, a text input is added, then the function should be called. ...

How to get raw markup for an org.w3c.Node

Possible Duplicate: How to I output org.w3c.dom.Element to string format in java? I have an xml snippet, like <div> <span> <a href="http://someUrl.com"&gt;Cool site, bro!</a> </span> </div> And an org.w3c.dom.Node, corresponding to my div element. How do I get a Node's String r...

php DomDocument: how can i print an attribute of an element?

Hiya. how do I print the an attribute of an element? example: $doc = new DOMDocument(); @$doc->loadHTML($page); $xpath = new DOMXPath($doc); $arts= $xpath->query("/td"); foreach ($arts as $art) { here i wanna print the attribute class of the td element, how do i do so ? } ...