Joel always said to be careful when using 3rd party libraries. From my initial impressions, JQuery is great. What should I beware of when using it? What are it's limitations? What headaches will I run into later on as I use it more?
...
Hi, I've been given the task of doing some work customizing an artist's space in MySpace. It seems that you sort of hack the HTML you want into your edit profile page (which has several empty boxes). The MySpace page, it seems, is already HTML so you can only hack into that. Suggested "tweaks" include incomplete HTML code (e.g., a <DIV> ...
I am trying to bind an event to a "method" of a particular instance of a Javascript "class" using JQuery. The requirement is that I in the event handler should be able to use the "this" keyword to refer to the instance I originally bound the event to.
In more detail, say I have a "class" as follows:
function Car(owner) {
this.owner =...
My website makes a lot of requests. I often need to cancel all current requests, so that the browser is not blocking relevant new requests.
I have 3 kinds of requests:
Ajax
inserted script-tags (which do JSONP-Communication)
inserted image-tags (which cause the browser to request data from various servers)
For Ajax its no problem as...
I got this bad feeling about how I insert larger amounts of HTML.
Lets assume we got:
var html="<table>..<a-lot-of-other-tags />..</table>"
and I want to put this into
$("#mydiv")
previously I did something like
var html_obj = $(html);
$("#mydiv").append(html_obj);
Is it correct that jQuery is parsing html to create DOM-Objects ? ...
I'm using Webkit-sharp to embed Webkit into an application and I need to hook certain links to perform actions in my app rather than their normal action.
I've considered using Javascript to iterate over the anchor tags and replace the ones that match with the proper link, but I'm wondering if this is the best way. Is there a preferred ...
Say for instance I was writing a function that was designed to accept multiple argument types:
var overloaded = function (arg) {
if (is_dom_element(arg)) {
// Code for DOM Element argument...
}
};
What's the best way to implement is_dom_element so that it works in a cross-browser, fairly accurate way?
...
I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available.
<div id="panel">
<div id="field_name">TEXT GOES HERE</div>
</div>
Here's what the function will look like:
function showPanel(fieldName) {
var fieldNameElement = document.getElementById...
Is there an efficient way to tell if a DOM element (in an HTML document) is currently visible (appears in the viewport)?
(The question regards Firefox)
...
I have an <img> in an HTML document that I would like to highlight as though the user had highlighted it using the mouse. Is there a way to do that using JavaScript?
I only need it to work in Mozilla, but any and all information is welcome.
EDIT: The reason I want to select the image is actually not so that it appears highlighted, but ...
In Internet Explorer I can use the clipboardData object to access the clipboard. How can I do that in FireFox, Safari and/or Chrome?
...
For a project of mine I would love to provide auto completion for a specific textarea. Similar to how intellisense/omnicomplete works. For that however I have to find out the absolute cursor position so that I know where the DIV should appear.
Turns out: that's (nearly I hope) impossible to achieve. Does anyone has some neat ideas ho...
Hi,
I have code to create another "row" (div with inputs) on a button click. I am creating new input elements and everything works fine, however, I can't find a way to access these new elements.
Example: I have element <input type='text' id='name_1' name="name_1" />
I then create element <input type='text' id='name_2' name="name_2" /...
Using Prototype 1.6's "new Element(...)" I am trying to create a <table> element with both a <thead> and <tbody> but nothing happens in IE6.
var tableProto = new Element('table').update('<thead><tr><th>Situation Task</th><th>Action</th><th>Result</th></tr></thead><tbody><tr><td>a</td><td>b</td><td>c</td></tr></tbody>');
I'm then tryin...
I'm parsing XML results from an API call using PHP and xpath.
$dom = new DOMDocument();
$dom->loadXML($response->getBody());
$xpath = new DOMXPath($dom);
$xpath->registerNamespace("a", "http://www.example.com");
$hrefs = $xpath->query('//a:Books/text()', $dom);
for ($i = 0; $i < $hrefs->length; $i++) {
$arrBookTitle[$i]...
I have a page which is largely created by DOM script, which generates a table of images (normal img elements) from several webcams (helping out a friend with a pet boarding and my HTML/DOM is a bit rusty).
It works fine in FF3 or Chrome, but not in IE7, In fact, the whole table is not visible in IE (but the body background-color is app...
Using jQuery, how do you check if there is an option selected in a select menu, and if not, assign one of the options as selected.
(The select is generated with a maze of PHP functions in an app I just inherited, so this is a quick fix while I get my head around those :)
...
I'm looking for a cross-browser method - I know IE has something (I've already forgotten what), and the way to do it in Mozilla may have to do with a focusNode thing I found, that seems related to getting text selections.
Methods involving jQuery or another common JS library are fine by me.
Thanks!
...
Hi, I'm creating a Firefox extension for demo purposes.
I to call a specific JavaScript function in the document from the extension.
I wrote this in my HTML document (not inside extension, but a page that is loaded by Firefox):
document.funcToBeCalled = function() {
// function body
};
Then, the extension will run this on some even...
I'm trying to place 4 of my image containers into a new pane, having a total of 16 images. The jQuery below is what I came up with to do it. The first pane comes out correctly with 4 images in it. But the second has 4 images, plus the 3rd pane. And the 3rd pane has 4 images plus the 4th pane. I don't know exactly why the nesting is ...