jquery

Difference in results returned between .has() and :has()

I have a gnarly navigation structure that can be generalized as: <ul id="navigation"> <li> A <ul> <li> B <ul> <li>C</li> </ul> </li> <li> D <ul> <li> ...

Using jQuery to copy an XML node to another XML file?

I'm trying to aggregate data from a number of different xml sources into a single xml file using either JavaScript or jQuery. I'm looping over the files, using jquery $.Ajax to read the file, and am selecting the first node (the node I want) and want to copy and append it to my destination xml file, then move on. I can select the first ...

best jquery way to find and filter and apply css classes

ok say we have <span class="foo">7</span> <span class="foo">2</span> <span class="foo">9</span> and want to apply a css class of 'highest' to 'span.foo'.text > 7 and css class of medium to values > 4 and <= 7 and css class of lowest to <= 4 example of desired result: <span class="foo medium">7</span> <span class="foo lowest">2</spa...

POST to password protected URL?

I am working on a project that requires me to POST some data to a url that requires a username and password for access. How do I build the URL so that it automatically logs into the system? $.ajax({ url: "https://xxxxxxx", type: "POST", data: "___PUT_BODY___="+file+"&file="+time, }) ...

How to replace more than once?

This is my code so far: $("h1.intro:contains('|')").each(function() { $(this).html($(this).html().replace('|','</span><br /><span>')) }); This works just once, but it has to work for all of those "|"... any ideas? ...

jQuery plugin for Excel like filter functionality

I need to implement a feature that would allow users to filter table data in Excel like style, i.e. dropdown menu in column headers with list of checkboxes or checkboxes grouped hierarchicaly. For instance for date column I would like to show treeview with year as root node, then month when year node expands and day on the last level. Al...

Preserve position on screen after shuffling items around

I have a long list of items where clicking on an item may move another related item to just below it. The problem is if the moved item appeared above the item being clicked, the move causes the page to scroll up and the mouse is no longer over the user center of focus. e.g. Item1 Item2 Item3 - clicking this will move item1 below it Ite...

Get is() and hasClass() for DOM element

Dear all, I have an element with a class. However, that element is not created when page is loaded, however it is created as a child-element as DOM ele. And each time if i want to check the availability of the class on this element it will return false eventho the class exists. I found out that it is because the element is not created w...

passing a javascript array to a django view

I'm using django and have a page of search results that I want to be able to filter by category with ajax (jquery) requests. There's a filter bar on the side of the page and when someone selects certain categories and clicks submit, those corresponding results should show up on the page. My code looks something like this: <input type=...

Jquery for loop doesnt stop

for (var i=0;i<ToArray.length;i++) { $.post('jquery/messages.php',{To:ToArray[i],subject:subject,msg:msg},function(data){jAlert(data);}); } User can send short messages to another user(s). The names are commaseparetad and after i split the string i want to send the same message to the different users with a for loop. if som...

jquery - building up an event for a text field "changing"? (keypress works except no backspace event)

I've got a "search" box that is supposed to be able to search data "live". Right now if I attach the "keypress" event to it and update the results, it works pretty good. However, if they press backspace it doesn't account for that (refresh the results). I understand I can probably account for the "backspace" key. But am I missing any o...

Get the href of the previous sibling and update the href of the current item

I've ended up and done this by hand, but I was thinking this could be done much quicker with some jquery. I have a table with dozens of the example rows below. What I'd like to do is find the previous siblings of the <a href="#">, grab their URL, change the filetype to .doc and apply. <tr id="node-20" class="child-of-node-19"> ...

jQuery delegate optimization

what is the best way to optimize the following snippets that uses delegate()? jQuery('.menu').delegate('li.gallery', 'hover', function () { jQuery(this).children('.submenu').toggleClass('hide show'); }); jQuery('.menu').delegate('li.interior', 'hover', function () { jQuery(this).children('.submenu').toggleClass('hide show'); }); jQuery(...

JQuery Accordion

Hey everybody. I'm having a little problem for some reason with a jquery accordion on my site. You can see my source here: http://www.newmusictheatre.org/events.html . Please help, the site has just gone live. Thanks, Ryan ...

How do I resize images and keep the proportion / aspect ratio with jQuery?

Hi, I have images that will be quite big in dimension and I want to shrink them down with jQuery while keeping the proportions constrained, i.e. the same aspect ratio. Can someone point me to some code, or explain the logic? ...

jQuery ajaxOptions -error works, why doesn't Success?

Hello, I'm using jQuery UI Tabs, and am using the sample code: $(function() { $("#tabs").tabs({ ajaxOptions: { error: function(xhr, status, index, anchor) { $(anchor.hash).html("Couldn't load this tab. We'll try to fix this as soon as possible. If this wouldn't be a demo."); } ...

jQuery: how to apply an effect to a parent element only when the child element hasn't been clicked?

I trying to create an "edit in place" table cell. You click an edit link, and a text area appears in its place. I also only want to display the edit link when I hover over the table row. The problem I'm having with the following code is that the edit link always appears when you hover over the table row. How can I make it so that the hid...

Stacked Tabs Interface (two or three rows of tabs)

I am looking for a solution for having stacked tabs in a web page. I know there are tons of tab implementations out there, but I haven't been able to find one that allows for multiple rows of tabs. When you select a tab from one of the rows above, that row of tabs would drop down to just above the content area (Windows does this in som...

How is :contains() supposed to be used?

I'm new to jQuery, but just attempting to create a function I can use to filter a table. I've got the table set up so that I can select all the rows by the class (which works fine) and call each() on the result. Inside the callback to each() I've got this if statement: if ($(this).find("td[name=firstName]:contains('ke')").size() > 0) ...

Event when css is done

At a certain stage, I am applying css to a section of my page. Is there an event one can get once the re-layout has completed? ...