jquery

Jquery radio button check

I want to check is there any radio button selected and if there is no selection to print some alert message. The html code is: <form action="" id="form" name="form" method="post"> <input type="radio" id="form_rd" name="form_rd" value="1"> 1 <input type="radio" id="form_rd" name="form_rd" value="2"> 2 <input type="radio" id="form_rd" na...

Alternate three and three rows in a table with jQuery

I want to set the alternate background color for rows in a table - but the twist is that I don't want every other row to be colored, I want to treat them in blocks of three rows. So for a table with eight rows I want the first three to be white, then the next three to have a background color, and the last two are back to white again. H...

Jquery Validation - Strip Form Data with submitHandler

I'm using the Jquery Validation plugin to validate and submit my forms. I want to be able to remove unnecessary form field values from the form data before they get posted to the server. I figured that the submitHandler would be the best place for this - here is a sample of my code: submitHandler: function(form) { if (form.elements["b...

JQuery Using Closest("element.class")

I am trying to find the closest tr that also matches a specific class name. The selector returns no matches. What am I not understanding? For example: <table> <tbody class="category" id="cat-1"> <tr class="category-head"> <th>Category 1</th> </tr> <tr class="category-item"> <th>Item 1</th> </tr> <tr> <td>This is a desc...

Get value of a checkbox?

Hi, I have a checkbox, how do I get its value using jquery? I have this example from searching: var checked = $('input[type=checkbox]:checked').val() != undefined; but how do I specify which checkbox I'm interested in, I want to only examine a checkbox with a particular id? Thanks ...

jQuery: position() on created element

The following code creates a div at the bottom of the page: var popup = $('<div id="popup" />') .appendTo('body'); The following code causes it to position correctly once there. $('#popup') .position({ my: 'left top', at: 'left bottom', of: $('#someDiv') }); But this code causes it to appear in the DOM but not be positioned...

jquery atrr("href") is not consistent ..in sharepoint

Hi all I have a jquery function(This is not written by me anyway still I am learning). In that we are replacing urls using f.attr("href") in several places. I am not understanding that from where this href value will be binded. And why the value(f.attr("href")) is changing place to place. I mean to say it is having some value @ one loca...

Does submit() function has a callback?

Hi, I have this code, and a file upload form which is submited to a frame: setMyCookie('name','value_1'); $('.myform').submit(); setMyCookie('name','value_2'); Problem: Webkit browsers seem to update 'MyCookie' with 'value_2' before the form gets submited, or in the exact moment it is being submited, so wrong cookie value is sent with...

Disable Link while animated Basket

Hi, I'm using this script for my online shopping basket: http://www.webresourcesdepot.com/fly-to-basket-effect-with-jquery/. Like people suggest in the comments it's easy buggy when you click multiple times on the same image. How can I disable the img link when it's clicked once and re-enable it when the product is added to the basket?...

How do you select a specific child div with jQuery?

How do you select a div which is a child of the current $(this)? I have many divs with the class row, in each of which I have a hidden div called form_explanation. I want to show() the div form_explanation when the row is onClick-ed. Thanks! ...

Trying to create scrolling horizontal thumbnail navigation that hides on left side when not in use

Hi, I am trying recreate the following type of scrolling thumbnail navigation as described in the following tutorial: http://tympanus.net/codrops/2010/05/10/scrollable-thumbs-menu/ I require my thumbs to slide out horizontally from the left. I have amended the code to the best of my abilities, but I can't get it to work. (Think the pr...

Dots and spaces in variable names from external sources are converted to underscores

Trying a bit of AJAX, and I find that much of my data is littered with underscores! Documentation confirms that this is working as intended. Any way to pass my form information to PHP intact? I'm using CodeIgniter, so my pass looks like /controller/function/variable, receiving controller: controller{ function($v=0){#what once was he...

How to overlay a div (or any element) over a table row (tr)?

I'd like to overlay a div (or any element that'll work) over a table row (tr tag) that happens to have more than one column. I have tried a few methods, which don't seem to work. I've posted my current code below. I do get an overlay, but not directly over just the row. I tried setting the overlay top to $divBottom.css('top'), but th...

JQuery, Hierarchical Table pagination.

Hierarchical Table and table pagination is asked several times. But I am looking for both of them together. Am already using JQuery in my application so plugin using same will be useful, but I am open for any suggestion. At present I managed to display Hierarchical data by using some jQuery plugin and added my own pagination method, but ...

Need Improvement with this script

This script I have found on StackOverflowe only... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head> <style> #appear_div { display: none; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/...

Is there a difference between placing JavaScript calls in $(document).ready(function(){ and placing them in HTML?

Is there a difference, performance or efficiency wise, between placing javascript calls such as blur, onclick etc. in $(document).ready(function(){ as opposed to placing them in HTML? Thanks! ...

IE7 is messing up the z-index property with my subnav (although I've already fixed that!)

OK, so I had this issue with my jQuery subnav in IE7 where it was scrolling down behind the main content after the header. Did a fair bit of research and found a great fix involving simply applying a z-index value to the header, and one to the main content. All was well. Or so I thought. Turns out IE7 is still messing up the subnav z-i...

jQuery works in FF but not in Safari

I have some event handlers that work in FF and not in Safari. Simply put, I have a list of friends, some hard-coded, some pulled in from a database. Clicking on a buddy opens a chat window... this is much like the Facebook chat system. So in Firefox, everything works normally and as expected. In Safari, clicking on buddies that are har...

jquery attribute indexOf

When I am getting at an attribute onclick of custom(Reporting Services) checkbox it gives me correct result. However when I am trying to use indexOf on that result it says "Object doesn't support this property or method", i.e. this is fine, gives me a long string $('input[id*=CustomCheckBox]').click(function() { alert( $(this).att...

How Do I Select a `td` Element in a Row That Has a Checkbox That is Checked?

I have a table that looks somethings like this: <table> <tr class="row even"> <td><input type="checkbox" /></td> <td class="name">foo</td> <td class="metric">22</td> </tr> ...etc What I want to do is get an array of all td.metric only in rows that have the checkbox checked. This didn't work out as expected: var ti...