dom

adding external .js using DOM then calling function from the .js

Hey all, I'm trying to build a bookmarklette. I want to minimize the size of the javascript within the bookmarklette so that I can maintain most of the code in an external file. My goal is to... 1) Add an external .js file to the page. 2) Call a function from that external .js file. 3) Have that function add additional .js files to the ...

forcing a dom rerender in ie8

I've tried all of the classic ie tricks to get my webpage to rerender the changes that have been made in the dom but nothing has worked. I've already tried element.className = element.className; as well as accessing some part of the dom I changed but that doesn't work either. Here's my code. Onload the body calls queryDB and in the ...

for ajax data insertion in page what is faster than innerHTML ?

I'm doing an ajax work where web service will return data and on client side and I am creating html table with data. I am using var (to hold string of generated html code), do string concatenations to generate table, tr and td tags and put data in it. Then I put this html table with data into a div using innerHTML. Please note I am apply...

Append numeric value to input name attribute with jQuery

I'm trying to add _1, _2 etc to the end of my input elements in a dynamic form. The user can add as many as they want I wrote this method but it seems to throw errors saying the "dName is undefined" $j("#addBranch").click( function() { //see withDataAndEvents, copie...

html tags inside xml tags - how access in javascript?

I'm passing my xml data through php where all xml nodes are contains html tags <bccfalna-ad> <ad-id>99</ad-id> <ad-title>New Ad</ad-title> <ad-code><u><b>C Language</b></u></ad-code> when i access this code in javascript, its easily access ad-id and ad-title but it always print null for ad-code node var edit_ad_id = xmlDoc.getElement...

Can I cut and paste structured data in Browsers via Javascript?

My users work with a dozen web applications. Over some I have complete control over others only limited via templates and Javascript (e.g. Zendesk). Between these Applications I want my users to be able to copy and paste structured data. With structured date I mean for example an address encoded as vcard/hcard. So when somebody "copies"...

mootools show/hide div dependent on whether or not checkbox is checked

I have a checkbox I wanting to show a fieldset in a form dependent on whether or not the checkbox is clicked or not? i.e if the checkbox is checked don't show the fieldset and if it is not show the fieldset. My markup looks like this, <fieldset class="toplined"> <label>Keep Image</label> <input type="checkbox" name="update_image[]" va...

If radio button checked add new form element using dom?

How do I use DOM in Javascript to check if a radio button is checked and then if so add new form elements to datesettings? //Radio buttons <input type="radio" id="dateoption" name="dateoption" value="1"> <input type="radio" id="dateoption" name="dateoption" value="2"> //Add new form elements <span id="datesettings"></span> Im current...

Finding line-wraps

Supposing I have some random block of text in a single line. Like so Lorem ipsum dolor sit amet, consectetur adipiscing elit. But for whatever reason (width settings on the containing element, use of text-zoom etc.), on the viewer's screen it displays as two or more lines. Lorem ipsum dolor sit amet, consectetur adipiscing elit. or ...

Javascript help. Adding/removing form element to DOM.

Hi, if radio button 2 is checked add input box into datesettings. How do i add an input box? If radio button 1 is checked do nothing but if button 2 was checked previously remove children. Can you help me Thanks function CheckDateOptions() { var o1 = document.getElementById("dateoption1"); var o2 = document.getElementById("dateopti...

jQuery events not being called when triggering 'change' event via fireEvent.

Problem appears on IE7-8. Here is simple demonstration: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"&gt;&lt;/script&gt; <script type="text/javascript"> // Selenium's trigger from scripts/htmlutils.js function triggerEvent(element, ev...

Accessing child divs using DOMDocument and XPath

I'm building a basic screen scraper for personal use and learning purposes, so please do not post comments like "You need to ask permission" etc. The data I'm trying to access is structured as follows: <tr> <td> <div class="wrapper"> <div class="randomDiv"> <div class="divContent"> ...

Current state of browser objects?

A web-browser window contains the window object. This object contains many properties. Many of those properties are objects. Some are constructors (XMLHttpRequest, Worker, File, ...), some are regular objects (document, location, navigator, history, screen, ...), some are non-constructor functions (a.k.a. methods) (alert, setTimeout, ......

How to identify when the DOM has been changed ?

Is there a simple way to know when the DOM has been changed ? Is there any built-in JavaScript/jQuery event/function for this ? ...

Is this possible to force execution of .click() for all elements, even those that are underneath ?

Consider this code: HTML: <div class='a'>a</div> <div class='b'>b</div> <div id='log'></div> CSS: .a, .b { width: 100px; height: 100px; border: 1px solid black; position: absolute; text-align: right; } .a { left: 100px; top: 100px; } .b { left: 150px; top: 150px; } JS: $('*').click(function(e) ...

How can I target a variable with string content in a jQuery wrapper ?

Basically what I am after is this, var foo = 'I am foo!'; alert(window['foo']); // output = I am foo! This does not work in a jQuery wrapper, I understand that it may be due to jQuery having renamed the window object or whatnot. If anyone has any inkling as to if this may be possible in a jQuery wrapper, I would appreciate the knowle...

JQuery - Check if next element of DOM has some classname

Hi. Ive this code : <div class="content"> <div class="tlcontent"> <div class="sideon" id="sideline0"> somethings </div> <div class="trackon" id="trackline0"> somethings </div> <div class="sideon" id="sideline1"> somethings </div> ...

Creating parent child element using DOM

I want to create the following DOM structure using jQuery. <li> <label> user <input type=radio> </label> </li> Here is my jQuery. $('<input>') .attr({type:'radio'}) .appendTo($('<label>')) .text('user') .appendTo($('<li>')) Some how it's not working or there is something wrong, what would be best practice here? ...

How do I insert a block of html after a block that I have just rendered on the DOM

I am building a block of nested divs around a specific element on the client. I am using jQuery's .wrap() initially to get the first part of the block which is working fine. But now I want to attach the ending block after the element I am wrapping and I am finding I can't attach it to anything because it is all being created at the same ...

how to fix opacity on IE6

how to fix opacity on IE6 This code does not work on IE6 ! filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.5; And this code ! $('#description').animate({opacity: 0.0}, 1000); ...