Hi all,
Is there a simple way to iterate over the child elements in an element, say a div, and if they are any sort of input (radio, select, text, hidden...) clear their value?
TIA for any helpful links or advice.
David
Edit to add link to example solution code. Many thanks to Guffa and the other respondents! I learned from this! ...
I was wondering if it would be more efficient to use document.getElementById() n number of times or to use document.getElementsByTagName() and loop through the result looking for the specific Element ids?
...
Webpage A is embedded in an iframe inside of webpage B. A and B are on two different domains and therefore the same origin policy prevents A from accessing properties of B like so;
location = window.top.location.href // emits a "Permission denied" error
Is there any other way for A to get B's url?
...
I have managed to get a custom very basic extension running in Firefox.
What I want to do next is:
Check if the user is on a desired webpage
If yes: check the page on each postback for a hidden element containing a string
If found: launch an external app with string parameter
I have some experience with javascript on webpages, but ...
<form name='form1'>
<select name='sel1'></select>
</form>
<script>
document.form1.sel1 ... //access element by it's name attribute, is this standard?
</script>
...
I have a Composite whose main widget has two children, thus:
public MyComposite() {
child1 = new FlowPanel();
child1.getElement().setId("child1");
child2 = new FlowPanel();
child2.getElement().setId("child2");
panel = new FlowPanel();
panel.add(child1);
panel.add(child2);
initWidget(panel);
}
Some time after construction of ...
I have table that uses inline editing with ajax to modify the fields. The table is sorted by last name.
If I change a last name so the row order is changed and then do a page refresh, the table is reordered but the field I changed still has the previous value in the dom. The input field does have the correct value in the html but the ...
I am wanting to be able to disable the click functionality of a radio button so I can uncheck it.
However, when I uncheck it, the click still fires and the end result is a radio that unselects (and modifies other page elements accordingly), and then re-checks because of the onclick event.
var clickFunction = function(e, radio, p){
...
I'm not a JavaScript wiz, but is it possible to create a single embeddable JavaScript file that makes all browsers standards compliant? Like a collection of all known JavaScript hacks that force each browser to interpret the code properly?
For example, IE6 does not recognize the :hover pseudo-class in CSS for anything except links, but ...
<div id="dad">
<img id="mum">
<input>
</div>
With jQuery, how could i get access to the input element, get is value or set it for example? I can't work out how to access something on the same level.. and i dont want to be using ID's, just parent/child nodes so i can use the code for loads of dad div's
Thanks!
...
I'm using DOM to parse string. I need function that strips span tags and its contents. For example, if I have:
This is some text that contains photo.
<span class='title'> photobyile</span>
I would like function to return
This is some text that contains photo.
This is what I tried:
$dom = new domDocument;
$dom->loadHTML($st...
$dom = new DOMDocument();
$dom->loadHTML($string);
$dom->preserveWhiteSpace = false;
$elements = $dom->getElementsByTagName('span');
$spans = array();
foreach($elements as $span) {
$spans[] = $span;
}
foreach($spans as $span) {
$span->parentNode->removeChild($span);
}
return $dom->saveHTML();
//return $string;
When I use this code t...
Suppose I have the following html, and no CSS
<div>
here is some content in this div. it stretches it out
<br />and down too!
</div>
Now I want to get the actual pixel width and height that the browser has rendered this div as.
Can that be done with JS?
Thank you.
...
I'm trying to use simple html DOM to extract everything inside a tag with the class "sitepoint". Here is my code that doesn't work:
<?php
include_once('simple_html_dom.php');
$html = file_get_html('examplewebsite');
$ret = $html->find('.sitepoint');
echo $ret;
?>
Below is an example of one of the sitepoint tags (there are ten or so)...
Hi,
i currently have a big problem with the rowIndex in the IE8. When i call the page i have an empty table element. With Javascript i now add Rows and Columns to this table.
// Create Elements
tr = document.createElement('tr');
td = document.createElement('td');
// Append Elements to existing Table
tr.appendChild(td);
table.appendChil...
jQuery can return last or first child,it works ok.
But I need to get second child.
This construction (get child by index) doesn't work,when get its text:
child.parent().parent().children().get(1).text()
So, how can i find non-last and non-first child (e.g. second)?
...
I'm writing a Firefox add-on and most of the time using
document.addEventListener("scroll", scrollListener, false);
works just fine. However on cuil.com that doesn't work. Basically any site that has a fixed header or footer that doesn't scroll causes a problem with the above code. How do I determine which element to add the event li...
<?
$string = '
Some photos<br>
<span class="naslov_slike">photo_by_ile_IMG_1676-01</span><br />
<span class="naslov_slike">photo_by_ile_IMG_1699-01</span><br />
<span class="naslov_slike">photo_by_ile_IMG_1697-01</span><br />
<span class="naslov_slike">photo_by_ile_IMG_1695-01</span><br />
';
$dom = new ...
So I've managed to get stuck using Prototype for a Project, and so far I can't stand it.
All I want to do, is replace a title within a very specific place - it has no ID and I can't change the HTML, since it's not hosted by me.
Event.observe(window, 'load', function() {
$$('#page #container .content .frame .entry h3.entry-title')....
I've recently started encountering a very strange problem. To be honest, I'm not entirely sure how to describe it other than to just show it.
Here's the relevant HTML:
<div class="component container w100 noEdit" id="contentWrapper">
<div class="component container w50" id="container1">
<div class="component text w50" id="text1">...