jquery

jquery problem: callback is fired for each selector (ie 3 selectors, fired three times)

This fires the callback twice: $('#get_started, #favour').fadeOut(300, function(){ $('#wrap_right').data('first_click_made', true); setup_tab_1(id); load_fb_js(); }); this doesn't but is it the best way to fix the problem? $('#wrap_right #favour').fadeOut(300); $('#get_started').fadeOut(300, function(){ ...

Writing a simple custom read more on click function for jquery that needs refactoring

I want to be able to reuse the same function many times on one page.. So here's some psuedo-code : $(".read_more").click(function(){ $(this).parents().find(".hidden_text").slideToggle("fast") }); The problem with this code, however, is that it targets every elem on the page matching .hidden_text. Is there a way to combine closest() w...

A reasonable number of simultaneous, asynchronous ajax requests

I'm wondering what the consensus is on how many simultaneous asynchronous ajax requests is generally allowable. The reason I ask, is I'm working on a personal web app. For the most part I keep my requests down to one. However there are a few situations where I send up to 4 requests simultaneously. This causes a bit of delay, as the ...

jQuery Optimization/Best Practices

Ok saddle up cowboys, because this is going to be a long one. I have been spending the morning going through some of my old code and I'm left wondering about best practices and optimzation. In order to avoid a ride down subjective lane I'll just post some examples with some hopefully easy to answer questions. I will try to keep the examp...

Hide/Show Values Inside TD tags

How can I hide or show the value contained inside a TD tag? E.g: <td id="dateCell<%= i %>"> <%= Html.Encode(row.ActionOn.HasValue ? Html.FormatDateTime(row.ActionOn.Value) : Html.Encode("")) %> </td> How can I get the encoded value and hide or show it depending on a condition? ...

JQuery page jumping to the top of the page

I am using this Jquery and it works great The problem is when i click on the button the page jumps all the way to the top. I am using Miva if that makes a difference $(document).ready(function(){ $('.drop').click(function(){ var $next = $(this).parent().next('li.drop_down'); if($next.is(':visible')) { ...

How to assign a link to a div and have it open in a new window

I have my click function set up to look for the first link in the div and assign that link to the entire div. $('.article-excerpt').click(function() { var newLink = $(this).find('a:first-child').attr("href"); if(newLink != "" && newLink != "#") { window.location.href = newLink; } return false; }); How can I also make that link...

what is jquery noConflict, why do we need that?

i have seen a jquery code that contains jQuery.noConflict method. do not know purpose of it, didnt get the why we need that. i only understand that it is something related to jquery plugin. please help me to understand. ...

'Permission Denied' when trying to make Jquery $.ajax request

function populateGroups(){ var p =1; var groupNames = new Array(); $.ajax({ type: "GET", url: "http://okcmonprd103/iMon/findgroups.pl", dataType: "text/xml", success: function parseGroupNames(xml){ $(xml).find('group').each(function(){ groupNames[p] = $(this).find('name').text(); ...

jQuery :not and :first ordering

Hi all, I am trying to get the first input field in a form that isn't disabled or hidden. I need to be able to exclude radio buttons, selects, and particular IDs. The following code works perfectly, EXCEPT when a select comes before the text or password field that I want: $("form :input:visible:enabled:first:not('select')"); If I exc...

jQuery ui list sorting

Hi There, I have a requirement to manage a queue of items similar to the link given below http://www.codeproject.com/KB/aspnet/NetflixQueue.aspx I have to sort the UL's li items using jquery. Its similar to a netflix queue where the user can change the order of items by drag & drop and also we need to have a button to move the selected ...

Use JQuery Cookie Plugin to save selectlist item in header?

Hello yet again! I created a ajax/ coldfusion select menu in my header on my website that allows one to select a department. This sets a session variable to the department ID. I want to be able to take my "datas" which contains the value of the select box and make sure that variable is applied to the selectlist everytime the header is di...

How multiple select to create a new row?

I have this code: <select name="team[]" size="8" multiple="multiple">$team</select> It lists for example players in that team, I want when user clicks on player it creates a new row where I can input basic info about player which I will add to database via php. ...

How to complete $.get() when a form is submitted using jQuery

I am using a third party shopping cart that sends a registration form to a .cgi script. I want to send information from that form to me, and the customer via a jQuery $.get() function call. The $.get calls a registration.mail.php script. The problem is that the form submitting seems to cancel out the ajax call before the ajax call can...

How to validate credit card exp date with jQuery

Hi, I need help validating an input's value against the current date. Basically i need to "addMethod" for the jquery validate plug in that would require the CC Exp Date - format MM/YYYY to be a future date no more than 10 yrs into the future. I have been looking for 2 days and have yet to find a good solution! Please Help! ...

USe JQUery Next() API to grab the data from a hidden Text Box

Hi all, I am doing some self-learning about JQuery and stuck over a question: I am trying to use the JQuery next() API to grab the data from the Text Box field of Hidden type, but I failed to do so. Here is my code: $(document).ready(function(){ $(".Testing").click(function(){ var what = $(this).next().val(); alert(what);...

Why is image preloading ineffective?

My CMS project has a stylish web 2.0 login screen that fades over the screen using javascript. How come that even though I have made 120% sure that images are preloaded (I used the resource monitor in development tools) they still take a second to show up when my login screen appears. It completely destroys the fanciness! Take a look: h...

applying Datepicker to newly created input using Live()

Im having a problem with the jqurey datepicker. My form has a "add another" button to give the user a extra row so they can enter more then one match. I want the date to display the datepicker and found how to do it with the live() function $(function() { $('#AddAnother').bind('click', function(event) { var ...

Selecting all dropdowns

Inside my form, I've declared dropdows the following way: Html.DropDownList(String.Format("Record[{0}].Action", i), new[] { new SelectListItem { Text="Ajustar Quantidade", Value= ((int)InventoryGoodsActionEnum.AdjustQuantity).ToString()}, new SelectListItem { Text="Relocalizar", Value= ((int)InventoryGoodsActionEnum.AdjustLocati...

JQuery slideup and slidedown is not smoot enough

I am implementing a slide dropdown and i am using this code $(document).ready(function(){ $('.drop').click(function(){ var $next = $(this).parent().next('li.drop_down'); if($next.is(':visible')) { $next.slideUp(); } else { $next.slideDown(); } }); }); but the client claim...