jquery

Changing position of children in <body> tag using jQuery

I am trying to change to position of children of the body. I obviously do not understand how to do so, but I thought it would be novel if the following code would work: var temp = $('body').children()[0]; $('body').children()[0] = $('body').children()[1]; $('body').children()[1] = temp; Sadly for me, it does not. I have searched and...

Get offset of node in whole html document in Javascript?

I'm looking for a way to get the offset relative to the whole document for a given node with Javascript. Eg.: <html><head></head><body><div id="mainContent"><h1 id="myTitle">Title</h1><p>First paragraph</p><p>Second <b>paragraph</b></p></div></body></html> Then (using JQuery): $("#myTitle").getDocumentOffset() should return 47 beca...

is there a jquery shortcut for triggering an input

I have to add an input with a name of "btnupdateprice" that I first have to dynamically insert it into the page (hidden of course) and then trigger it. Is there a way to do this without inserting it into the page like the following? A shortcut perhaps? $("input[type='hidden'][name='ProductCode']").before('<input type="image" border="0" ...

jQuery offset() issue in UIWebView

I’m working on an app that uses a UIWebView to render content. This webview is in a UIScrollView which, when the user scrolls near the top (or bottom), will append another webview above(/below) the visible one in the scrollview (i.e. pseudo-infinite scrolling). I’m computing the offset of various elements in the WebView with jQuery’s .o...

jQuery Live for drop box selection (change)

Hi, I'm having a problem getting content loaded into a document to fire jQuery scripts. I have the following code $(".jquery-selectbox").change(function(e) { url = this.options[this.selectedIndex].value; $('#pane2').fadeOut(500, function () { $('#pane2').fadeIn(500); ...

jquery ScrollTo laggy perfomance in IE, Opera, FF

I am using jquery scrollTo plugin and I am having laggy performace. Animation is not SMOOTH!! Especially in IE! demo page: http://toformos.org/test/ Animation looks great in Chrome!! And another problem is with resizing. When you resize the browser, overflow:hidden, doesnt work anymore. Can you just let me know where the problem migh...

remove class - jquery

I want to remove this class on checkbox toggle. $("#checkbox").toggle(function () { var it0 = $('#IT0').text(); var ip1 = $('#sv1').text(); var TC = "<div class='" + ip1 + "' id='" + it0 + "'><input type='text' name='test' value='" + ip1 + "'></div>"; $('#selected').html(TC); }, function () { var it0 = $('#IT0').te...

Hover animation with jquery

Hi there; I have written a very basic jquery script that is true theorically but not in browser: <ul class="menUl"> <li> <a href="#">TEMPLATE<span>DESIGN</span></a> </li> <li> <a href="#">FRONTEND<span>CODING</span></a> </li> <li> <a href="#">SERVESIDE<span>CODING</span></a> </li> <li> <a href="#">CONTACT<span>ME</span></a> </li...

Google maps API map.openInfoWindowHtml with jquery and fancybox iframe

Ihave problem with google maps. 1st i open Gmap like someone already click on point: "map.openInfoWindowHtml(point, xhtml);" - that's ok 2nd in var xhtml i put link to "Get Directions" - that's ok 3rd i want: if someone click on link in "InfoWindow" to open iframe with FancyB, just like someone visit "http://maps.google.com/" and write o...

How increase in specifity of a selector affects jQuery performance?

In other words, which line is easier for jQuery to perform: $("#id3") or $("#id1 #id2 #id3"), where id1,id2 and id3 are nested divs' ids. Are there any rules for writing fast jQuery selectors? ...

Looking for Ajax Onload Design Pattern

I'm involved with updating a Rails appp from 2.2 to 3.0, specifically in dealing with the changes for unobtrusive Javascript for the AJAX portions of the application. The move to JQuery is going pretty much as expected, but the one area I'm having a bit of philosophical trouble with is the implementation of history control for the AJAX ...

What is the problem with Ajax (jQuery) And Php

What is the problem with Ajax (jQuery) And Php ? Why my code does not work ? jQuery Code: $(document).ready(function(){ $.ajax({ type: "GET", url: "Tags.php", dataType: "xml", success: function(xml) { alert("success"); } }); }); Tags.php Code <?xml version="1.0" encoding="UTF-8"?> <tages> <?php ...

How to tell jQuery to stop searching DOM when the first element is found?

From what I understand adding .first() or :first to a query doesn't stop DOM search after the first match, it just tells jQuery to take 1st element out of matched collection. If it is true, then is there a way to stop DOM search after the first match? For example if I know that the result of this query will always be a single element, ...

Form that spans many pages

How do I create a form that spans over multiple pages? I would like to ask a large amount of questions, and based on the answers of previous questions, new specific questions will be asked. ...

jquery: trying to "sync" 2 html tables (apply column widths)

hi, i'm having 2 tables: table1 (the "header-table", which only has 1 row with table columns) - and table2 (the "data-table", which has several rows with all the data). table1 has widhts assigned to most columns. i'm now trying to apply the column widths from table1 to the 1st row of table2 (table1 has same width as table2). my code i...

jQuery code working everywhere but IE, why?

The following code works fine in browsers other than IE. In IE, only the #toggle-instructions handler works, but #toggle-cue-sheet-instructions does not. Anyone know why IE has trouble with this? What happens is that clicking on the link with id=toggle-cue-sheet-instructions does nothing while clicking on the link with id=toggle-instruct...

jQuery: Color fade

Is it possible to have 2 colors (red, green) and give the percentage of fading. Example: black (#000000) => white (#ffffff) --- Percent: 50% => grey (#808080) Is this maybe possible with jQuery xcolor, if yes, how? (the xcolor.analogous example return circa the colors I want to have, but how could I set the percentage of fading?) ...

AJAX MYSQL JQUERY PHP - TOUGH, TRIVAL QUESTION - Try yourself!! :)

This is a quiet trival question. Here goes: Trying to use AJAX / JQUERY to create a text field. As soon as I start writting on the text field, it should dynamically link to a new page with the text field (and its values) on top that page without reloading the page. So, for instance, as soon as I type "S" (for "StackOverFlow") in the te...

Joomla : How to load template options depending on a specific menu Item

Hi I am developing a site based on Joomla 1.5 and I wanted to know how can we load varying template options dependiing on a menu item ID. A good example of what i am looking for is with the Gantry Framework (http://www.gantry-framework.org). Here you can change template settings on a per menu Item ID basis. A simple PHP or a jQuery s...

Jquery select class from variable

Hi, I am using Jquery to find a class by variable. So, var className = "whatever"; $("#container ul li") if contains element with className, do this How do I write the above code? Is it $("#container ul li").find("."+ className).each(function(){ console.log("I found one"); }); Obviously the code doesn't work ...