jquery

Navigating through list items

I have the following code: var from = 0, step = 5; function showNext(list) { list .find('li').hide().end() .find('li:lt(' + (from + step) + '):not(li:lt(' + from + '))') .show(); from += step; } // show initial set showNext($('ul')); // clicking on the 'more' link: $('#more').click(function(e) { e.preventDefault(); ...

How to make onclick automatically through onload function

I have a href link and I would like it to be clicked when the page is loaded. ...

how to prevent checkbox check when clicking on link inside label

Hello, I have a link inside a label. The problem is, when user clicks 'back' after having read the terms, the checkbox is unchecked, because when they clicked on the link they also unchecked the box at the same time, since the link is inside a label. <input type="checkbox" id="terms" name="terms" checked="checked" /> <label for="terms...

jquery validator plugin, how to apply it on on-fly created form?

I am having following js code(similar-sample here) that creates form function addsection(){ var newForm = $("<form id='forma1'/>").submit(submit call here).validate(); --for loop i 1 to 5 { var inpt = $("<input />").attr('name', 'inpt').addclass('required').appento(newform); if(x) inpt.att('type', 'chec...

Marginal browser support by the BBC (and why the BBC they can't use jQuery)

The BBC just released their JavaScript library, Glow. They rolled their own because the major libraries don't adequately support older browsers. I'm wondering if I should take the time to learn the library. Do other large institutions have similar laws and rules regulating them that prevent them from using the mainstream libraries such ...

Waiting for images loading with JQuery

I trying to wait for images finished to load but it seems that the load event is never matched. Here's my code : $(function() { var arrowWidth = 22; var currentImageID = -1; var imageOffsets = new Array(); var loadedImages = 0; var numberOfImages = $("div#sliderGallery > ul > li").size(); $("div#sliderGallery > ul").hide(); $("div#sli...

Using an ASP RadioButton to fire JQuery slidepanel functionality

I have a web application. It is separated into three sections, each with its own asp update panel. I am using the $(.Selector).slideToggle('slow') jquery method for one of these sections to hide/show the section if the use clicks an HTML link...Another section of the application contains two ASP radio buttons. I need to trigger the cl...

JQuery Text slideDown / slideUp Overlay on Image Keeps Bouncing?

I am trying to replicate the text overlay effect that occurs when you mouse over an image - found on the Guardian web site. I have it working except when my mouse goes over the trail-text area that area bounces (slideDown slideUp) repeatedly a number of times. I think it is because the trail-text area becomes the focus and causes the m...

What would cause myDivId.toggle() to work while myDivClass.toggle() does not?

I have some DIVs that I am using JQuery to hide and show using the toggle() function. This has been working fine. But I just recognized some relationships between some of these DIVs that would allow me to group some of them into a class. I was hoping that this would allow me to toggle the DIV class instead of each of the DIV ids. So ...

Does the order of the elements in the jQuery wrapped set always match the order the elements appear in the markup?

Is the order of the elements in the jQuery wrapped set guaranteed to match the order the elements appear in the markup? I ask because I need to perform an operation on a set of nested elements, and I need to always do the operation in order of the nesting. Can I just run the operation using .each iterator on the matched set and I'll ...

jQuery $.ajax(), $.post sending "OPTIONS" as REQUEST_METHOD in Firefox

Having trouble with what I thought was a relatively simple jQuery plugin... The plugin should fetch data from a php script via ajax to add options to a <select>. The ajax request is pretty generic: $.ajax({ url:o.url, type: 'post', contentType:"application/x-www-form-urlencoded", data: '{"method":"getStates", "prog...

jQuery realtime form validation

I am currently using $.blur(fn();) for form validation, but this only takes effect when the form field loses focus. Is there a way of doing it on keypress to get realtime validation? I suppose I could do the 'poll all fields every second' approach, but I am sure there must be a more elegant way? ...

How to turn a very long column into multiple shorter ones?

This is a challenge question / problem. Hope you find it interesing. Scenario: You have a very long list (unreasonably long) in a single column. It would be much better displayed in multiple shorter columns. Using jQuery or another tool, what do you do? The format of the list is as follows: <div class="toc"> <dl> <dt>item 1</dt> ...

How can I reduce the redundancies in my jQuery code?

The size of my JavaScript file is getting out of hand because I have hundreds of links, and each one has its own jQuery function even though they all peform basically the same task. Here's a short excerpt: $("#link1").click(function () { $(".myDiv").hide(); $("#myDiv1").toggle(); }); $("#link2").click(function () { $(".myDiv").h...

Filter table from <select> input using jQuery

I'm trying to filter a table from an alphabetical <select> input with jQuery. I have first and last names in two columns of the table, and I'd like to filter the rows by either of these. I have a select input set up as so: <select> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> ....

Losing jQuery item data on "move".

In essence: every time I clone items I lose the data() value for those items. The long story: I have a three column table that is storing items dynamically entered from a JSON object. Each of these items has a data value set that I use. $.getJSON(jsonUrl, null, function(data) { jsonData = data.items; for (var key in jsonData) { ...

How to change a class's content using jQuery

Here is the div element on my page: How can I change a class's content? So from existing which is: class="jcarousel-next jcarousel-next-horizontal" to class="jcarousel-next jcarousel-next-horizontal jcarousel-next- disabled jcarousel-next-disabled-horizontal" Do I need to completely remove it by using removeClass and then re-add? ...

how to get just numeric part of css property with jQuery?

I need to do a numeric calculation based on css properties. However, when I use this to get info: $(this).css('marginBottom') it returns the value '10px'. Is there a trick to just getting the number part of the value no matter whether it is px or % or em or whatever? Thanks! ...

Shoud these two JQuery functions produce the same behavior?

Assuming I have the following two JQuery functions - The first, which works: $("#myLink_931").click(function () { $(".931").toggle(); }); and the second, which doesn't work: $("#myLink_931").click(function () { var class_name = $(this).attr("id").split('_')[1]; $("."+class_name).toggle(); }); I want to replace the first with...

Jquery GetJSON called twice for aspnet mvc partial view

Hi I have a page which contains a html.RenderPartial, that renders an aspnet mvc partial view. The partial view is used as a jquery dialog and is opend from the page where it is rendered. The problem is that inside the partial view I want to load and store a variable when the dialog is displayed. This data is used for some lookup while...