How do I bind events to html elements that don't exist at the time of the script loading?
One part of my script adds these to the DOM:
<a class="btn-remove-item" href="">link</a>
The problem is I can't just do:
$(document).ready(function(){
$(".btn-remove-item").click(function(){
this.parentNode.removeChild(this);
}...
I was reading about document fragments and DOM reflow and wondered how document.createDocumentFragment differed from document.createElement as it looks like neither of them exist in the DOM until I append them to a DOM element.
I did a test (below) and all of them took exactly the same amount of time (about 95ms). At a guess this could...
Does anyone know of any Ruby libraries/gems that allow you to traverse a DOM quickly?
I need something which is fast, and doesn't have a lot of dependencies. I've been trying to use Nokogiri, but I'm concerned with the number of 'bug segmentation faults' I've been getting.
...
At the moment I have a nice class that generates HTML and allows me to create pages without having to worry about things like closing tags, proper nesting, or clear formatting. The syntax is simple and straight forward,
//Create an anchor tag
$anchor = new Tag("a", array("name"=>"anchor");
//Create a paragraph
$paragraph = Tag::Craft("...
I'm trying to write a greasemonkey script that only displays photos with the tags bacon.
The site it runs on is written like so:
<div class="photos">
<ul>
...
<li>
<a href="photo1"> <img src="http://somesite.co/photo1.jpg" </a> <br /> <a href="tags_photo1"> <span class="tags"> bacon, delicious </span> </a>
</li>
...
</ul>
</...
I have installed xampp 1.7.3 and the php version is PHP 5.3.1.When iam using the function domxml_open_file() ,it throwing an error Call to undefined function domxml_open_file().
How i can enable DOM in php.Thanks in advance.
I canot find 'extension=php_domxml.dll' in php.ini file,
so i added extension=php_domxml.dll this in php.ini fi...
Hi,
I have the following part of DOM:
<div id="content">
<div id="div-1"></div>
<!-- here new DOM -->
<div id="div-2"></div>
</div>
I need to insert new part of DOM between "div-1" and "div-2".
How I can do it with jQuery?
...
Hi,
I am currently modifying a piece of code and I am wondering if the way the XML is formatted (tabs and spacing) will affect the way in which it is parsed into the DocumentBuilderFactory class.
In essence the question is...can I pass a big long string with no spacing into the DocumentBuilderFactory or does it need to be formatted in ...
Sample HTML Data
<body style="width:300px;">
<h3>Long-Text</h3>
A simple tool to store and display texts longer than a few lines.
The search button will highlight all the words matching the name of objects that are members of the classes listed in searchedClasses, itself a member of the KeySet class. The highlighted words are hyperte...
Given the following XML file:
<?xml version="1.0" encoding="UTF-8"?>
<process
name="TestSVG2"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<sequence>
<receive name="Receive1" createInstance="yes"/>
<assign name="Assign1"/>
<i...
Hi coders!
I've spent whole days with PHP's DOM functions but i can't understand how it works yet. :(
I have a simple XML file that looks okay but i cannot use it how i think when i've created it's structure.
Sample XML fragment:
-pages //root element
-page id="1" //we can have any number of pages
-product id="364826" //we...
Source on Github: http://github.com/tschellenbach/Fashiolista-Button/blob/master/buttons.js
Blog post explaining the code
http://www.mellowmorning.com/2010/08/03/creating-your-own-diggfacebook-liketweetmeme-button/
The current dom load version is rather verbose.
I need the domload event because the code detects all a[href] elements i...
Hi folks,
I recently needed to append some data to dynamically created LI elements. In my first instance, I used .data() in a way like
var _newli = $('<li>foobar</li>');
_newli.data('base', 'ball');
// append _newli to an `ul`
that.. was terribly slow. This logic happens in a loop which can easily grow up to 500+ items, it took ages!...
I'm trying to retrieve a page with greasemonkey and then extract a link from it, inserting the link into the current page. I'm having some trouble with:
GM_xmlhttpRequest({
method: "GET",
url: "http://www.test.net/search.php?file=test",
onload: function(data)
{
if (!data.responseXML)
{
data.responseXML = new DOMParser...
Hello All
I am "attempting" to scrape a web page that has the following structures within the page:
<p class="row">
<span>stuff here</span>
<a href="http://www.host.tld/file.html">Descriptive Link Text</a>
<div>Link Description Here</div>
</p>
I am scraping the webpage using curl:
<?php
$handle = curl_init();
...
When a textarea has more text in it than can be shown it will display scroll bars. How can I make it so that the textarea will expand itself when it has more text than it can display. My goal is never to have scroll bars appear. A jQuery solution is preferred.
...
We're using a third-party analytics reporting script provided by this analytics company. It adds a 1x1 pixel image into the DOM with reporting data in the URL of the image.
Is there any way for me to monitor the DOM and intercept this <img> element and change its "src" attribute before the browser requests the image?
Sounds like a real...
Hi all,
I've tried so many different possibilities to achieve what I feel like should be a simple code execution. I am loading DOM objects from the server via .load(). One of the loaded items is an input text box with a date in it. I want to load the jdpicker (a plugin datepicker) when I click on the input box. Due to the behavior of .li...
I'm trying to create a continually rotating banner for the top of the homepage of a site I'm developing. The best way that I can figure to keep it constantly in rotation is to take the first DIV (firstChild) and move it to the end of the stack once it's slid out of view.
This:
<div id='foo0'></div>
<div id='foo1'></div>
<div id='foo2'>...
I've got a little problem with an XML file. I need to take the content of the tags (in the XML file) and save them in a MySql data base , using PHP .
My supervisor asked me to use DOM, but everything I do isn't workin'.
My XML file looks like this :
<?xml version="1.0" encoding="windows-1252"?>
<BIENS>
<BIEN>
<CODE_SOCIETE>0024</CO...