I have about 100 <span class="foo">, 100 <span class="bar"> and 100 <span class="baz"> tags in my document. I need to implement the following operations in JavaScript:
Change the background all foos to red, all bars to green, all bazes to blue.
Change the background all foos to green, all bars to blue, all bazes to red.
Change the back...
Hey there,
I am running a jQuery animation driven splash / web page with (soon to be) hash and hijax driven links and pages. When proceeding through the splash to a specific page, every modern browser is capable of hijaxing links and applying the jQuery rollovers, etc.
However, when going directly to a hashed link from an outside page ...
As recommended in a previous question of mine, I am using the PHP Simple HTML DOM Parser
as a way to search an HTML document and grab contents from a specific element (in my case, a textarea). I was wondering if anyone had used this before and was able to give me any advice for my problem (or recommend another solution). The code I'm usi...
In the Google Chrome debugger, I often want to get a reference to a node in the DOM tree. I can click the "magnifying glass" button and then click the desired element in the browser window to select the corresponding node in the DOM tree displayed in the debugger. But how can I get a reference to that node in the console?
If the eleme...
I can't seem to figure out how to inject a disabled element. Any help will be appreciated.
I apologize, as I made several mistakes posting this. First of all, i was applying the attribute to an h3 element (how do you disable that??, you don't). Also, I'm afraid I have tried a : with still no effect. Please forgive my error, and here is ...
I am having trouble with JS closures:
// arg: an array of strings. each string is a mentioned user.
// fills in the list of mentioned users. Click on a mentioned user's name causes the page to load that user's info.
function fillInMentioned(mentions) {
var mentionList = document.getElementById("mention-list");
mentionList.innerH...
If I open a browser dialog with window.open, can I move HTML DOM object back and forth?
I know how to use jQuery's .detach() to move stuff (with all bound events) within the page. I wonder if there is a way to do it between a page and it's child dialog.
The main purpose is to support a "detach" or "tear off" functionality for a widget...
Is there any way to reorder or manipulate a set of inputs before posting to a script for processing?
I'm able to reorder the elements in the DOM no problem, but getting this to happen after the user presses the submit button and before the browser makes the POST is a bit tricky. I'm using the ajaxForm plugin in jQuery. There is a beforeS...
I want to learn how to write the Javascript/CSS/HTML side of my applications but I want to skip the CSS kludges, bad Javascript, and non-semanitic HTML of the past and jump directly to HTML 5, CSS 3, clean Javascript libraries. I've been reading Mark Pilgrim's Dive In HTML 5 which I think is awesome and now I'd like the equivilent books ...
I have developed a custom dijit Templated Widget. I have to do some DOM manipulation of the children of the containerNode. Everything works fine, except when I have two of the Widgets loaded, and the manipulation of the children of the containerNode seems to affect all of the Widgets of the same type, not just the particular instance o...
Sorry, if the title is too obscure ;D.
Actually the problem is, lets say i am this code.
<span id="spanIDxx" style="blah-blah">
<tag1>code here </tag2> sample text
<tag2>code here </tag2> html aass hhddll
sample text
</span>
Now if i will use the code.
jQuery("#spanIDxx").html();
then it will return just the innerHTML e...
There are two methods to add HTML-code to the DOM and I don't know what is the best way to do it.
First method
The first way is the easy one, I could simply add HTML-code (with jQuery) using $('[code here]').appendTo(element); which is much like element.innerHTML = [code here];
Second method
Another way is to create all the elements ...
I need to embed one webpage within another, the inner page will be wrapped by a <div> and not contain the html,head title or stuff like that, however the inner page can contain <link>'s to css that I dont want to affect the outer page
I currently fetch the html with ajax and insert it into the outer dom, to workaround the styles conflic...
Why doesn't this piece of code work?
When I used the commented part instead of the table it works...
Use table why cannot work?
<html>
<head>
<script type="text/javascript">
function addLine() {
var p = document.createElement('p');
p.innerHTML = "hello";
document.getElementById("ad...
I'm developing a registration page and wish to use JS to dynamically choose avatar selection based on gender. Here's what I have so far..
<select name="gender">
<option value="Male">Male
</option>
<option value="Female">Female
</option>
</select>
And that should update options in this based on gende...
What is the easiest way to pretty print (a.k.a. formatted) a ord.w3c.dom.Document to stdout?
...
I am working on an administration page to add an article to a site.
Two of the fields ("Tags" and "Resources") begin with only once instance labeled "Tag 1" and "Resource 1" respectively.
Using jQuery, I allow the user to add additional tags and/or resources ("Tag 2", "Tag 3", etc) and it works ALMOST as I want it to. If the page has b...
Every time I need to write a piece of JavaScript which monitors an input box, I usually end up doing something like:
$("#field").keyup(myHandler).keydown(myHandler).change(myHandler);
It’s not perfect, but it usually works in most cases, and so I move on. I just happen to have a little bit of time to investigate this properly. Probabl...
I must be missing something basic here. Enlighten me.
I'm trying to grab the ID (289 in this example):
<tr class="header">
<th>ID</th>
<th>2</th>
<th>3</th>
</tr>
<tr class="highlight">
<td class="">289</td>
<td class="">field a</td>
<td class="">field b</td>
</tr>
... more rows
I'm using this selector:
$("#requests :n...
i have a page around 500 div as below.
<div onclick='test()' class='test>
<ul class='innermenu'>
<li>1</li>
.....
</ul>
</div>
when the test function is called it need to hide the menu (innermenu) who calls that function.
my problems are
1. uniquely identify the div without using id
2. How to...