FALCONSEYE
Programmer
Is there a way to get a checkbox value from its className? I am trying to implement a toggle() function. When a user clicks on a checkbox it shows a textarea to enter stuff. They can use upto 10 textareas. On page load, I show only 4 textareas. Right underneath, there is a checkbox to add/remove the textarea. On show(), I will need to add another checkbox in case they want to use the 5th text area. This is what I have so far:
this is the checkbox:
Code:
<script>
$(document).ready(function() {
<cfoutput>
<cfloop index="j" from="4" to="10">
$('[class^=toggle-item-link#j#]').hide();
$('[class^=container#j#]').hide();
</cfloop>
</cfoutput>
$('[class^=link]').click(function() {
var $this = $(this);
var x = $this.attr("className");
var y = $(x).val();
alert('this is y:'+y);
alert(x);
$('.toggle-item-' + x).toggle();
$('[class^=container4]').show();
return false;
});
});
</script>
this is the checkbox:
Code:
<input type="checkbox" name="addNew#i#" id="addNew#i#" class="link#i#" value="#i#">