jquery

jquery variable inside live function not working

I have this piece of code $('ul.fonts li', '#wizard').live('click', function(e){ $('ul.fonts li', '#wizard').removeClass('selected'); $(this).addClass('selected'); $('blockquote').css('font-family', $(this).find('a').attr("class") ) e.preventDefault(); }) I tried ti optimize this code storing the selector in a variable. var $fonts_li...

JQuery: How to break out of .each() and return a value for a function

I want to use return false to break a .each() but also return a value at the same time. How can I do this? Please refer to a work-around function to see what I am trying to do: function HasStores(state) { var statehasstores = false; $(stores).each(function (index, store){ if(state == store.state && store.category == "...

Rails 3 - AutoComplete with jQuery

Hello, I'm interested in using the Rails 3 AutoComplete plugin for jQuery but the one tutorial provided doesn't match my use case. Hoping for some help... Plug In: http://github.com/crowdint/rails3-jquery-autocomplete-app I have a Permissions Controller where people can add team members. On the Permissions SHOW view I want to show a a...

Capture form submit when submitted from another library

Is it possible to capture the form submit event when that event is triggered from another javascript library dynamically based on a button click event? ...

Slidetoggle a div based on the link clicked

Trying to get the div with class sbox to slide up and down based on the stoggle that has been clicked. Can't figure this out. (I have hundreds of these so I'd like to set up something generic instead of multiple different classes.) $(".stoggle").click(function () { $(this).slideToggle("fast"); }); <div class="wrapper"> <a clas...

jQuery UI Selectable - unselect selected item on click

Hi, Does anyone know if there's a way to configure a jquery ui selectable element to unselect the selected element when you click it? Sort of like a toggle. If it's already selected, unselect it, otherwise do the default behavior. Thanks. ...

jquery slideshow won't work because file attribution might be wrong

Hi, I recently launched some web pages using a jquery slideshow plugin which, of course, was working just fine on my hard drive. But now that the pages are on the server, I keep seeing an error code that the 'mygallery' file is undefined. I fixed this by pointing to the public folder location where the files are located but the script s...

Only perform jQuery ajax query once

How can I get jQuery to only do an ajax query one time? Right now it contacts the server every time a user toggles "Comments (X)" // Replies - Toggle display of comments $('.info .reply').click( function() { $('.reply', this.parentNode.parentNode).toggle(); return false; }); // Load comments $('.info .reply', this).mousedown( ...

How many elements does it take for event delegation to become worthwhile?

Reading another SO question about jQuery performance, I started thinking about the point when it becomes worth using event delegation rather than binding to elements individually. I was thinking mainly about jQuery, but I suppose it is probably applicable for Javascript in general. Event delegation has two main purposes: allowing han...

Hover over image to show buttons and don't trigger when hovering over actual buttons

I'm trying to get buttons to appear when hovering over an image. The following works: jQuery('.show-image').mouseenter(function() { jQuery('.the-buttons').animate({ opacity: 1 }, 1500); }).mouseout(function() { jQuery('.the-buttons').animate({ opacity: 0 }, 1500); }); However, when moving from the image to the button (wh...

A jQuery plugin to do auto-completion of filenames similar to filebrowser widgets?

I need a better solution for auto-completion when the values being auto-completed are file names. I have an application that requires the user to input the name of a file (to be fed to a static analysis engine based on Perl::Critic, in case anyone is curious). File-upload isn't an option for a couple of reasons, the main one being that I...

How to implement the famous light box effect with jQuery?

Possible Duplicate: What is a good jQuery/Ajax lightbox plugin? I'm not an JavaScript guy, but I believe that jQuery has got that cool Apple-style light box effect. Or am I wrong? How would I implement that? Are there tutorials on how to do this? Or's there something far cooler than lightbox? (well, I've heard of it like 5 ye...

the this in jquery plugin is giving back undefined

Could someone explain why this.rel is giving back undefined and also what the regex is supposed to do. If this.rel is undefined the regex will not work either and is causing some kind of error because the alert underneath will not fire? $.fn.facebox= function(settings) { init(settings) function clickHandler() { $.face...

Expandable DIV on-click - on demand

Hello, I've been searching lots and found many tutorials for Javascript / jquery on click expandable divs.. e.g. http://www.dustindiaz.com/basement/block-toggle.html However what I am looking for,is slightly different .. I need to load the div content on click... rather than hidden loading the div in the background... with display:none...

selectedIndex - javascript on Google Chrome

Can anyone please tell me why doesn't this work on Google Chrome: val = document.form.option[document.form.selectedIndex].value; How should I get around this so that other browsers (like IE and FF) don't get screwed up. Many thanks in advance. ...

ColorBox Grouping Photos

Im using color box, i have it working fine, except i don't understand how to add multiple images to the gallery when it is clicked. Here is the page i am working with: CLICK the FIRST FLOWER http://newsite.702wedding.com/las-vegas-wedding-flowers.aspx But i need 2 images to appear for each flower. Thanks for your help! ...

pass function in json and execute

Is there any way that I can pass a function as a json string (conversion with JSON.stringify), send it to another function, parse the json and then execute the function that was in the json? I am using jquery and javascript. ...

Javascript NiceEdit Configuration Question

Hi, I'm trying to use nicedit from http://nicedit.com Currently I'm using this to add nicedit to all text areas: bkLib.onDomLoaded(nicEditors.allTextAreas); How do I configure these wysiwygs? I found I can configure single boxes by: new nicEditor({fullPanel : true}).panelInstance('area2'); But how do I do this when using bkLib.on...

Jquery lightbox not working when calling to html in php

I have jquery plugin that flips the div box when it's clicked. When it's flipped over I have a thumbnail that when clicked should pull up my lightbox but it just pulls up the image in a different page. I'm calling multiple div using php arrays. I have tried every way to call the images but nothing works. Here is some of the code. ...

What's a good way to display a loading image until an ajax query completes?

Right now it contacts the server every time a user toggles "Comments (X)" I'd like to make it so as soon as a user clicks ".info .reply" (Comments (X)), an ajax loader appears just until the data is finished loading, then the loader disappears. // Replies - Toggle display of comments $('.info .reply').click( function() { $('.reply'...