jquery

keydown combination

how do i check if a combination of keys are pressed with jquery? lets say i want to fire up an alert only when the up and down arrow keys are pressed at the same time. right now im just using: switch (event.which) { case 40: alert('down'); break; case 38: alert('up'); break; case 37: ...

jQuery auto-apply plugins

hi, wrote a little jquery gallery plugin and i'm initializing like this: myDiv.tGallery(); my question: is it possible to have jQuery detect if the HTML markup contains gallery code (eg. defined by its classname .myPlugs_gallery) and auto-apply the plugin code? currently i'm having a global init-routine which goes like $(".myPlugs_tGa...

What are pros and cons of letting Google host jQuery for me ?

Possible Duplicate: Should I link to Google APIs cloud for JS libraries? Do you serve jQuery to your users from Google on a public websites ? ...

Accessing a div with Class using jquery.

Hi everyone, I have a div with Class. For example <div class="button check"></div>.The css is defined for both 'button','check'. I want to access the above div through jquery and write something in the div.I tried with $('.button check').html("sample data"); I do not see anything being written when I run the page. Please help me. ...

jQuery: How to use event.preventDefault() with custom events?

How can I know in my triggering code that preventDefault had been called? $(document).trigger('customEvent', params); if (/* ??? */) doDefaultActions(); ...

iframes with jQuery

Hey all, I have a script which is purely JS which takes code and inserts it into an iframe: var html = "<p>Some <strong>HTML</strong> to insert</p>" var iframe = document.getElementById('contentsframe'); iframe = (iframe.contentWindow) ? iframe.contentWindow : (iframe.contentDocument.document) ? iframe.contentDocument.document : iframe...

load partial with jquery and rails

Im curious about what the best way to load a rails partial with jquery. So far I have tried a solution not working: $('#imagecontent').load('/newsletters/_image_gallery.html.erb', function() { alert('Load was performed.'); }); Is the best solution to build a seperate action and/or controller for this and set up a route? Im asking beca...

IE not selecting form field when label is clicked an form field is hidden

I am using jQuery to hide form fields (I am manipulating checkboxes and radio buttons). In FF and Chrome, when I click the associated label, the form field still activates and checks. In IE, that does not happen. How can I have the label activate the checkboxes/radio buttons in IE? ...

JQuery Media Plugin playing file outside the webroot

Is it possible to play a media file which is outside the webroot using the Jquery Media Plugin. The server that we are on is windows based. The file path for example is: \server\share\music.mp3 In my testing so far it does not seem possible. ...

Does anyone know of a very simple jQuery dropdown menu with smooth fadeout (or slide-down)?

Does anyone know of a very simple jQuery dropdown menu plugin where the opacity goes down smoothly (or where the menu slides down smoothly)?? ...

Using jquery, how to redirect to a page based on whether target page is available?

Looking for some quick help to what is likely a well known problem. I have two pages to access an application, one public with a log in box and one on our intranet with a auto authentication via network id. Our goal is to automatically connect to the page with the login box only IFF a user is not on the network (e.g. at home and not on ...

center an element?

if i've got a line of links like: <a>foobar</a><a>foobar</a><a>foobar</a><a id="center">foobar</a><a>foobar</a> but one of them got an id="center", could i with javascript or css position it in the center? ...

My unsolved problem in jquery animation

I have written very simple image rotaror with jquery: HTML: <div class="left" id="main"> <ul class="gmain" > <li class="active"> <div class="gleft"><img src="images/php.jpg" alt="" width="450" height="300" class="g-img"/> <span class="g-span">1-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras dapibus urna null...

jquery sum problem

I want to keep my total sum every time I sort my column from my table <thead> <tr class="titlerow"> <th></th> <th></th> <th align="left"> <asp:LinkButton ID="Programs" runat="server" CommandArgument="Asc" CommandName="G1" CssClass="table-sort active" OnClick="Programs_Clic...

jQuery UI - Plugin for inputting a number as hex?

On a recent project, I need have a hex mask (0x0 - 0xFF) as one of the input fields on an HTML form. I know I could just use a regular input to get the hex value, and then I can validate it along with the other form submission validation. However, for some of the other decimal fields I am using ui.spinner.js (github) to allow the user ...

Handling rapid clicks in jQuery

I'm building a site (with jQuery 1.4) which has a floating (fixed position) basket. Current working functionality (Demo here): When the user clicks the basket itself it toggle slides open/closed and toggles a "locked on" class When the user clicks an 'add item' link in the page it slides open, adds an "on" class and fades in a notice ...

jQuery - getting custom attribute from selected option

Given the following: <select id="location"> <option value="a" myTag="123">My option</option> <option value="b" myTag="456">My other option</option> </select> <input type="hidden" id="setMyTag" /> <script> $(function() { $("#location").change(function(){ var element = $(this); var myTag = ele...

jQuery's removeClass or toggleClass not working in ie8? Why? How do I get it to work correctly?

The following example works fine in Firefox and Opera, but not in ie8. However, if I turn compatibility mode on in ie8, it works correctly. Why? And how do I fix it? The below example shows the use of toggleClass, but replacing this with addClass and removeClass still has the same problem. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 T...

using index in jquery 1.4.1

Hi all, I have a ul and on hover I want to retrieve the id attribute of the li being hovered over. I have tried selecting the li and on hover I tried to retrieve the ID using the jquery 1.4.1 index function. $("li").hover( function(){ $('#articleimage').append(this.index(this.attr('id')));}); As a simple test, I even tried the follow...

Jquery / Javascript find first visible element after scroll

I have code like below: <div id="container"> <div class="item" id="1">blah blah</div> <div class="item" id="2">blah blah 2</div> </div> But actually there are lots and lots of with class='item'. Basically as the user scrolls this great long list of items I want to change the style of the current top visible one (like google reader...