[jQuery] Re: Toggle Div Based on Value

2009-07-24 Thread Liam Potter
This should work fine $(document).ready(function() { $("#directors input[type='checkbox']").click(function() { $('span.RelStatus').each(function() { var RelStatusValue = $(this).find("span").text();

[jQuery] Re: Toggle Div Based on Value

2009-07-23 Thread Liam Potter
could you paste the outputted html to jsbin, in the meantime, try this $(document).ready(function() { $("#chkIncludeRetired").click(function() { $('.RelStatus').each(function() { var RelStatusValue = $(this).text(); if (RelStatusValue == 'Retir

[jQuery] Re: Toggle Div Based on Value

2009-07-23 Thread evanbu...@gmail.com
I removed some of the server-side code but this is it. thanks $(document).ready(function() { $("#chkIncludeRetired").click(function() { $('#table1 .RelStatus').each(function() { var RelStatusValue = $(this).text(); if (RelStatusValue == 'Re

[jQuery] Re: Toggle Div Based on Value

2009-07-23 Thread Liam Potter
I'll need to see your html to see why, but I suspect it's because you targeted a specific id #table1.RelStatus. evanbu...@gmail.com wrote: Very cool. This is what I have now but it only hides the first div containing the RelStatus value = 'Retired' $(document).ready(function() {

[jQuery] Re: Toggle Div Based on Value

2009-07-23 Thread evanbu...@gmail.com
Very cool. This is what I have now but it only hides the first div containing the RelStatus value = 'Retired' $(document).ready(function() { $("#chkIncludeRetired").click(function() { $('#table1.RelStatus').each(function() { var RelStatusValue = $(this).t

[jQuery] Re: Toggle Div Based on Value

2009-07-23 Thread Liam Potter
$("span a").click(function(){ var checkValue = $(this).parents("div").attr("value"); if (checkValue == 'Retired'){ $(this).parents("div").toggle(); } return false; }); You will see the parents function, this allows you to traverse up the dom.

[jQuery] Re: Toggle Div Based on Value

2009-07-23 Thread evanbu...@gmail.com
Right, but how do I associate the span tag which contains the value = 'Retired' with the div that contains it? In other words, I need to toggle the contents of the entire div and not just the span tag. Thanks. On Jul 23, 7:41 am, Liam Potter wrote: > use an if statement, "if value == retired, d

[jQuery] Re: Toggle Div Based on Value

2009-07-23 Thread Liam Potter
use an if statement, "if value == retired, do this" evanbu...@gmail.com wrote: Hi I'm not sure how to approach this. I want to toggle each div with a checkbox or hyperlink which shows/hides every div where the RelStatus value = 'retired'. I'm able to see the value of each RelStatus value using