This is generally how I manage progressive enhancement whilst keep the experience clean, but how safe is it? is there potential for a race condition and this not working?
Imagine the simple abstract scenario, you want to display something differently if you have javascript support.. this is generally what I will end up doing:
<div id="...
How would I check if all the div's with class test are hidden. And if they are all hidden set wrap1 to hidden. Thanks.
<div id='wrap1'>
<div class="header">Header 1</div>
<div class='test'><a href="#">Test 1</a></div>
<div class='test'><a href="#">Test 2</a></div>
<div class='test'><a href="#">Test 3</a></div>
</div>
UPDATE:
Thanks ev...
I'm using Firefox 3.5. My doctype is XHTML 1.0 Strict. Let's say I want to insert an image into a div with id "foo"; then I might try:
var foo = $('#foo');
foo.html('<img src="bar.gif" />');
This does indeed add the image. But I noticed that this was causing some odd behavior later in the document, which I suspected might be due to XH...
I have a form with a few fieldsets. One fieldset has a table of time preferences set by the user. The user can add and delete time preferences. When they add a row, a table row is dynamically inserted into the DOM using a jQuery append().
The issue is that in IE6 and IE7 any relatively positioned elements on the page do not "bump" do...
Hello!
I have something like that as input:
<root xmlns="urn:my:main"
xmlns:a="urn:my:a" xmlns:b="urn:my:b">
...
</root>
And want to have something like that as output:
<MY_main:root xmlns:MY_main="urn:my:main"
xmlns:MY_a="urn:my:a" xmlns:MY_b="urn:my:b">
...
</MY_main:root>
... or the other way round.
How do ...
I have a div that needs to be moved from one place to another in the DOM. So at the moment I am doing it like so:
flex.utils.get('oPopup_About').appendChild(flex.utils.get('oUpdater_About'));
But, IE, being, well, IE, it doesn't work. It works all other browsers, just not in IE.
I need to do it this way as the element (div) 'oUpdater...
Hey everyone,
Given a GMarker JS variable, how do I obtain the HTML DOM element that represents it? I need this so I can insert a <div> of my own into the map with the correct z-index.
Thanks.
...
I'm new to the whole JavaScript and jQuery coding but I'm currently doing this is my HTML:
<a id="tog_table0"
href="javascript:toggle_table('#tog_table0', '#hideable_table0');">show</a>
And then I have some slightly ponderous code to tweak the element:
function toggle_table(button_id, table_id) {
// Find the elements we n...
I have a form which posts data to the same page. Based on the user's radio button selection I am inserting checked="checked" into the radio button form element to redisplay the correct selection. This works fine, however when the form is redisplayed (in case of bad input etc), I need a div to be revealed (containing the relevant fields f...
Is this HTML valid? Or is the id 'a' the same as the id 'A'?
<div id="a">alpha</div>
<div id="A">Alpha</div>
...
I posted a question yesterday dealing with parsing json data. In one of the follow up answers someone said I was taking a performance hit by using the jQuery append() function within each iteration, while using each().
I was doing:
$.getJSON("http://myurl.com/json?callback=?",
function(data) {
// loop through each post
...
I have a DOM element with an ID similar to:
something[500]
which was built by my Ruby on Rails application. I need to be able to get this element via jQuery so that I can traverse my way up the DOM to delete the parent of it's parent, which has a variable ID that I don't have access to beforehand.
Does anyone know how I could go abo...
I have an XML file as follows:
<rootNode>
<link>http://rootlink/</link>
<image>
<link>http://imagelink/</link>
<title>This is the title</title>
</image>
</rootNode>
The XML Java code using DOM is as follows:
NodeList rootNodeList = element.getElementsByTagName("link");
This will give me all o...
I know you can use window.print() to print the current page... but what I want to know is can I build a document using javascript in order to populate it with data and print it off?
Just like you can have html/xml as a javascript object, can you do something similar to this:
var name = "Matt";
var htmlDocumentToPrint = "<html><body><di...
I have a regular div, like so:
<div id="registry_ViewPanel">
<div id="registry_Header">Register</div>
<div id="registry_Content">
//Registry fields here
</div>
</div>
with css:
#registry_ViewPanel {
width:400px;
height:400px;
border:1px solid;
background-color:#fff;
display:none;
position:fi...
I'm going through the DOM using childNodes and I have a reference to a Text node, and I need to modify its "inner HTML" .. but I tried and it does not work or have such a property. Apart from replaceChild(), what functions can I use to manipulate the inner HTML of this Text node?
...
Hi -
I'd like to be able to select a specific option within a dropdown list in order to manipulate it.
For example,
$("#mylist > option14").replaceWith(<option value="option155">New Option</option>
How can I do this?
Selecting through the child selector doens't seem to work.
Thanks.
...
i have some content like this
var p =
i myself
Abhimanyu Singh
Yadav
when i m trying to insert into as innerHTML to some div the whole content appears in one line.i m using <pre> tag to avoid this problem.but need some appropriate solution.
...
Basically what I have is this:
<body>
<div class="class1">
</div>
<div class="class2">
</div>
<div class="class3">
</div>
...
</body>
I have no idea why the site creator used classes instead of IDs (they're unique), but it doesn't really matter as I'm writing a GM script and so getElementsByClassName('')[0] effectively does the ...
I have written a Greasemonkey script which manipulates the contents of certain elements with the following selector:
$("span.relativetime").each(function() { $(this).html("TEST"); });
However, sometimes matching elements are added to the page through AJAX, and I don't know how to handle those new elements. I have tried this, but it d...