I've written the JQuery below, and have had to search for items in the DOM using multiple calls to .parent() because the ClientIDs rendered in ASP.Net are built up dynamically in the html. I'm aware that this will cause problems each time we change the markup code, and would like to see if anyone knows of a better way to do this in ASP....
I am studying computer science and we have to do a programming project which must be strongly related to XML and using XSD and XSLT or XQuery/XPath at least. Because I like C# I'd like to do it in this language, but I could use another if anyone has another idea.
My Idea is now to code some kind of appointment book. I imagine that all a...
Is $('*').index(currentElement) will give a unique number?i am asking because i can't understand the index method good from the JQuery docs
...
I have the following problem:
I need to insert N rows after row X. The set of rows i need to insert is passed to my function as chunk of HTML consisting of TR elements. I also have access to the TR after which i need to insert.
This is slightly different then what i have done before where i was replacing TBODY with another TBODY.
The...
In javascript, what are the pro's and con's of encoding an onclick event in the DOM and in the HTML itself?
Which, if either, is better than the other and why?
...
In a particular script I'm writing, I have a number of objects which are linked to some DOM Elements. Given that each element has a unique id, should each object keep just the element's id (and use document.getElementById each time), or store the element in a property?
Here's a simplified example of what I mean:
function myThing(elId) ...
I have an Iframe which I have enabled designMode on. Quite simply I would like to have a callback function called if the cursor in the Iframe moves or content changes. It seemed quite simple at first but I can't use onchange/ onkeyup on the Iframe.
I assume I need to add an event to a member of the Iframe. I've tried
frames['writer'].d...
I've created a JavaScript script that can be pasted on someone's page to create an iFrame. I would like for the person to be able to paste the script where they would like the iFrame to appear.
However, I can't figure out how to append the DOM created iFrame to the location where the script has been pasted. It always appends it to the v...
I would like to create a DOM node, set the 'id' attribute and then append it to 'body'. The following seems not to work because jQuery doesn't see my template as an object. How can I tell jQuery to treat it as an object so find() works on it?
var template = "<li><div class='bar'>bla</div></li>";
template.find('li').attr('id','1234');
...
I've been struggling quite a bit with Xerces C++ and my unfamiliarity with all that is XML, but I need to use XML for a project I'm working on.
My question is how do I serialize portions of a DOM tree that I have already parsed and created of out of a XML instance document (validated against a schema I wrote) so that I can create many n...
This is a simple question that hopefully has a similar simple answer to it as well.
If the id of a div selector is stored in a string, how can I select the div object dynamically.
This is what I currently do, and I am convinced that jQuery must have its own way of doing this:
<div id="boo">Some content...</div>
var divName = 'boo';
v...
Is there an easy way to store form data in a data() object after submit?
Suppose this is my form:
<form id='myform'>
<input type='text' name='bar' value='lorem'/>
<input type='text name='foo' value='ipsum'/>
</form>
After submit the data should be stored like this:
$("#myform").data('bar','lorem');
$("#myform").data('foo','ipsum');
...
I have two divs like so
<div id="parent" style="width:100px:overflow:hidden;">
<div id="child">
tooooooooooooooooooooo much content to fit in parent
</div>
</div>
I'm dynamically updating the content of child and scrolling it using Jquery. I would like to be able to find how wide the child is so I know when to stop scro...
Is there any way to copy (deep) element from one DOMDocument instance to another?
<Document1>
<items>
<item>1</item>
<item>2</item>
...
</items>
</Document1>
<Document2>
<items>
</items>
</Document>
I need to copy /Document1/items/* to /Document2/items/.
It seems that DOMDocument doesn't have methods to import no...
I have an application that allows a user to view details on a specific case w/out a postback. Each time a user requests data from the server I pull down the following markup.
<form name="frmAJAX" method="post" action="Default.aspx?id=123456" id="frmAJAX">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" />
</div>
<div>
<i...
I've have the following (PHP) code that traverses an entire DOM document to get all of the text nodes. It's a bit of a ugly solution, and I'm sure there must be a better way... so, is there?
$skip = false;
$node = $document;
$nodes = array();
while ($node) {
if ($node->nodeType == 3) {
$nodes[] = $node;
}
if (!$skip && ...
When I replaceWith an element to bring one out of the DOM, then replaceWith it back in, events registered to it do not fire. I need to events to remain intact.
Here's my Javascript:
var replacement = $(document.createElement('span'));
var original = $(this).replaceWith(replacement);
replacement
.css('background-color', 'green')
...
Following up on my question about jQuery.get() I was wondering if there is a list of DOM properties and methods that aren't available in jQuery that can only be accessible if you were working with the raw DOM object (i.e. $("#someID").get().scrollHeight; )
...
I can't fetch text value with Node.getNodeValue(), Node.getFirstChild().getNodeValue() or with Node.getTextContent().
My XML is like
<add job="351">
<tag>foobar</tag>
<tag>foobar2</tag>
</add>
And i'm trying to get tag value (non-text element fetching works fine). My Java code sounds like
Document doc = db.parse(new File(a...
Hello,
In PHP with DOM, I have a DomElement object which represents an <identity/> element.
I have one case where I need to change this so its element name is <person/>, but keep the same child elements and attributes.
What would be the simplest way of changing an element name of a DomElement and keeping its children and attributes?
...