Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    JavaScript


Jquery :: Change Background Of <td> By Checking Value Of A Checkbox Inside It?

Change the Background of <td> by checking the value of a Checkbox inside it .Below is my code, But it is not working. code...

View 6 Replies (Posted: Jun 28 at 14:35)

Sponsored Links:

Related Forum Messages For JavaScript category: - Change The Checkbox Background ?
I am having three check boxes on my form. I would like to change the background color of the check boxes when checked. Is it possible to write a single script for all the check boxes on my form?

Posted: Jun 28 11 at 12:42

View 4 Replies!   View Related
Possible To Change Td Background When Checkbox Is Checked?
Does anyone know how I can change the background of the containing td cell of a checkbox when it's checked? And change it back when it's unchecked?

Posted: 04-16-2009, 07:19 AM

View 11 Replies!   View Related
JQuery :: Using Checkbox To Change Background Colors Of Random Elements?
I have a dynamically produced photo gallery using ASP. Each photo is contained by a <div> with the photoID as the ID and a checkbox to select that photo. For example:

<div id="<%=rs("photoID")%>">
<img src="blah.jpg"><br>
<input type="checkbox" id="checkbox_<%=rs("photoID")%>" onclick="selectPhoto(<%=rs("photoID")%>)">

I will then have a JS function that changes that particular DIVs background color to show it is selected, I just made this up, hope it's right:

function selectPhoto(id)
if (document.getElementById('checkbox_'+id).checked == true)


So, if the checkbox that was clicked, was checked, then change BG color to something that highlights my photo. If the checkbox that was clicked, was not checked, then change back to the original color.

This seems simple enough to achieve but where I'm now getting confused, is how I could change all the highlighted photos back to white, in one go, if a user clicks an 'un-select' checkbox called 'unselect_all'.

I'm thinking of a function that will gather all checked checkboxes in that form 'gallery_form', get the ID's of the checkboxes, minus the 'checkbox_' prefix, then change all those DIV ID's back to the original color, white.

Or... I could alter the DIVs to have an ID prefix, like 'photo_<%=rs("photoID")%>', find all DIV Id's that have that prefix, then change the background colors.

Although I can see the function in my head, my basic JS skills don't allow me to write such a script, without a little help..

Posted: Oct 8 at 16:40

View 2 Replies!   View Related
JQuery :: Change Background Color Of Table Row When Selecting A Checkbox?
I have 5 columns in a table. Column 1 has a check box named name="strurl1", name="strurl2", name="strurl3" , etc. If selected the table row background color is to change from #f1f1f1 to #e5e5e5 .

I tried but the code is not working.

The main css is

.overviewtable tbody tr td {
border-top:1px solid #FFF;
border-bottom:1px solid #c4c4c4;


The table columns are named col1, col2, col3, col4 and col5.

Posted: Dec 6 11 at 1:18

View 4 Replies!   View Related
JQuery :: Change The Background Colour Of A <label> If A Checkbox Is Checked?
Using JQuery, is there a more efficient way of writing this code? See below


Posted: Sep 23 10 at 10:06

View 2 Replies!   View Related
Change Background Color Of Row When I Click Checkbox?
How to change background color of row when I click the checkbox?

Posted: Apr 1 10 at 5:11

View 1 Replies!   View Related
Change Background Color When Someone Unclicks A Checkbox?
To highlight a row my code is:

function highlight_row(row_id)
var row = document.getElementById(row_id); = "yellow"; // background yellow


How I do I unhighlight the row when the user unclicks the checkbox for that row?

Posted: May 1 11 at 6:39

View 3 Replies!   View Related
JQuery :: Change UI Dropdown's Background Color Depending On Checkbox Status
I'm using jQuery UI SelectMenu and jQuery UI Custom Checkboxes and Radio Buttons to style a form on a page. In setting up the form, I define my dropdown as such:

width: 378,
maxHeight: 238


The code for determining whether or not the checkbox (#basic_cov_life) is checked is working... it's just the code to change the color back to grey that isn't working:


what to do to change the background color back to light grey? And also, though I haven't gotten to it yet with the above code, I would need the text to change back to grey as well.

Posted: Aug 23 at 16:36

View 2 Replies!   View Related
Jquery :: Change Background Colour On Table Cell And Check Checkbox?
I have have a table with the class "pretty".

Each row has a checkbox next to it that selects the data using a form.

I want to be able to click the cell and have the checkbox ticked/unticked.

I have this working using

$(document).ready(function () {
$('.pretty tr').toggle(function() {
$(this).find(':checkbox').attr('checked', true);
}, function() {


Posted: Sep 26 at 5:21

View 2 Replies!   View Related
Jquery :: Change Div Background Inside Tr
I am looking for a way to change the background of a div inside a tr onclick with jquery.

What I mean by this is that when the tr (which is named by class) is clicked, then the div with a class name (that is inside the tr) changes color.

The problem that I have been having is that I can set the color of all the divs with the specified class name but not just the one that I clicked it's tr.

I would think the code would look something like this:

Here is the HTML:

Posted: Oct 1 11 at 15:21

View 3 Replies!   View Related
Change A Single Value Of Checkbox Inside A LocalStorage?
I'm trying to change a value inside localstorage. This item is the status of a checkbox. I want, everytime that a checkbox is checked to set the value to true or false of that checkbox. I tried many ways until I realized that there is no way you can change a value without using JSON.

To add the value I use:

localStorage.setItem("status-" + i, $":checked"));

and to delete I use:

var parentId = $this.parent().attr('id');
localStorage.removeItem("'" + parentId + "'");

Now to change the value I tried:

$itemList.delegate("#status-" + i, 'click', function(e) {
var $this = $(this);
var parentId = this.parent().attr('id');


This is how my local storage looks like:

I've been working on it for few days... Here is a fiddle for it: [URL]

Posted: Sep 1 11 at 12:11

View 1 Replies!   View Related
Change Background Image With If Statement Or Call Function Inside Of If?
Basically I want to have a different background image for every time of the day. The function by itself works okay with onclick or onload placed in body.

function changesky()
document.getElementById("sky").style.background="url(back_morning.jpg) repeat-x";


Posted: 01-17-2010, 10:53 AM

View 5 Replies!   View Related
JQuery :: Checking Every Checkbox In DIV
The page I am working on will have a series of checkboxes. The boxes will be in the format of "parent" with one checkbox and then a "child" div with multiple checkboxes. The idea is being able to check a parent checkbox and have all the checkboxes in the preceding child div get checked as well.

Here is the layout:
<div class= "parent_div">
</label><input type='checkbox'/>
<div class = "child_div" >
<label> child </label>
<input type = 'checkbox'/> .....
This does not work. The checkboxes do not get checked.

I know that the selector is working because if I assign a function to them like this:
$(".parent_div INPUT[type='checkbox']").
var child = $ ( this ).
next( ".child_div" ); $ ( child ).
children ().
change (
function (){
alert (
); }); });

It will work, the function get"s assigned to each checkbox in the div. Why my boxes are not getting checked? On a side note I found this curious, if I try to access the checkboxes by specifying a selector type in the children method like this :
$( child ).
children ( "INPUT[type='checkbox']" )
$( child ).
children ( "input" )
It doesn't select the boxes. In case anyone mentions it I know that the child divs are not actually children of the parent divs, all these values are coming from a database and the names were chosen based on the database relationships.

Posted: 10-May-2010

View 2 Replies!   View Related
JQuery :: Checkbox Not Checking When Used In Toggle() / Fix It?
I have this jQuery code, which uses the toggle() function on a checkbox input (via ID #rescheck), to reveal a hidden div on click/tick of the checkbox - it all works perfectly, except that the actualy "tick" or "check" does not appear in the box, on Chrome.

In Firefox its the opposite, the check or tick is always present from page load, regardless of whether the hidden div iss visible or not.code...

Posted: Aug 25 10 at 3:01

View 1 Replies!   View Related
Checkbox Checking...
I have a form that produces a few checkboxes via a server side script. Once on the page, the source looks like this...

<td><input type="checkbox" name="access" value="1" checked /></td>
<td><input type="checkbox" name="view" value="1" checked
<td><input type="checkbox" name="access" value="2" checked /></td>
<td><input type="checkbox" name="view" value="2" checked

...what I'm trying to do is pass through the value of the checkbox
ticked through to a function. This function will then, depending on
whether the box is ticked or not, untick the access# checkbox.

I can pass the number through to my function, but I'm having
difficulty trying to reference the actual checkbox from the script.
This is what I've got so far...

function AM_MenuSelection(opt) {
var myOpt=document.frmNew.view[opt].value;

As you can see, I can reference the value of the object, but need to
be able to access the related access# object.

Posted: 05-02-2006, 03:30 PM

View 3 Replies!   View Related
JQuery :: Remove Validation Message By Checking A Checkbox In It?
I am trying to remove a validation message from the screen when a user checks a checkbox. I do require that the user enter a last name in a text box before they click the submit button. If they dont, the validation message appears. I am trying to hide or clear that validation message when they select a check box on the page. The HTML for it is below but am wondering if you canremove the messagein JQuery.[code]...

Posted: 04-Mar-2011

View 3 Replies!   View Related
Jquery :: Jstree - Pre-checking Checkboxes Using The Checkbox Plugin
I'm using JsTree 1.0 and having trouble pre-checking checkboxes using the checkbox plugin. Here's my full code:


I've added the bind event for loading.jstree, but this isn't correct - doesn't work.

Posted: Sep 27 11 at 18:20

View 2 Replies!   View Related
Jquery :: Use Script To Have Checking 1 Checkbox Uncheck Other And Vice Versa?
The reason not to use radio buttons here is because I want the option to have all checkboxes unchecked, and there are other behaviors linked to checking and unchecking.

When the 1st box is checked, all radio buttons in the row are selected. (see here How to use javascript to select a row of radio buttons when a checkbox is selected)

When the 1st button is unchecked, all the radios in that row are deselected.

Whenever a checkbox is checked, the other checkbox should automatically be deselected.

I'm thinking maybe I could do this by css class. So, whenever one checkbox in the class is checked, the others are automatically unchecked.

I'm imagining code like this code...

Posted: Nov 28 11 at 1:57

View 2 Replies!   View Related
Jquery :: Click Event For Checking One Main Checkbox And Disable All Other?
i m trying to make a function in jquery to disable a group of checkboxes on click one main checkbox

function is

function DisableCheckboxes(id)


problem is the click event donot gets applied and the main checkbox gets checked

Posted: Dec 2 11 at 17:47

View 2 Replies!   View Related
Checking Checkbox By Clicking An Image
I have checkboxes under the thumbnails, here: URL... I want to do that by clicking the thumbnail, checkbox gets checked. I think this can be done with javascript.

Posted: Jan 7 11 at 15:42

View 4 Replies!   View Related
Checking That The Background Image Has Loaded?
This is my code:

.css('background-image', 'url(' + images[imageToLoad].url + ') no-repeat center center')

Somehow the load event never triggers here when the background image has loaded. What event should I capture to know when the background has loaded?

Posted: Oct 17 11 at 12:11

View 2 Replies!   View Related
JQuery :: Html - Hide Table Columns Automatically By Checking A Checkbox?
I want to display 3 checkboxes that are pre-checked, but as soon as the user unchecks a box, the related column disappears.

<p><input type="checkbox" name="first_name" checked> First Name</p>
<p><input type="checkbox" name="last_name" checked> Last Name</p>
<p><input type="checkbox" name="email" checked> Email</p>


Posted: Jan 12 11 at 19:42

View 2 Replies!   View Related
JQuery :: Background Toggle - Change My Sites Background Color
I am trying to change my sites background color. The color changes but it doesn't go back to the first image anymore. does anybody know what the problem could be?

jQuery Code:

HTML Code:

Posted: 29-Apr-2011

View 1 Replies!   View Related
JQuery :: Fade In A Background-position Change For A Background Image?
I am using a giant sprite for an element that changes different states at hover. I was wondering if there was a way to have the hover state image fade in? You can view my code live - here

Here's my code for the hover state for each span

function () {
$(this).css("background-position","0 -121px");
$(".hf-2").css("background-position","0 -242px");


I am using Jquery to do the background image hover instead of basic css cause i have multiple hovers that need to be reset.

Posted: Oct 27 10 at 4:31

View 3 Replies!   View Related
Copyright 2005-08, All rights reserved