I tried to set up an append text and remove text to a checkbox that is
clicked. I tried the following it works for append perfectly but the remove
manipulation freezes firefox and explorer.
$(document).ready(function(){
$("[EMAIL PROTECTED]'checkbox']").click(function(){
if ($(this).is(":checked")){
$(this).siblings("ul").hide("normal");
$(this).parent("li").append("Complete!");
} else {
$(this).siblings("ul").show("normal");
$(this).parent("li").remove("Complete!");
}
});
});
Is there an alternative to remove?
Kristinn Sigmundsson wrote:
>
> Made a reply before, but I think I've messed with my subscription so
> it never came up.
> Here it goes again, first alot of code:
>
> <html>
> <head>
> <script type="text/javascript" src="js/jquery.js"></script>
> <script type="text/javascript">
>
> $(document).ready(function(){
>
> $("[EMAIL PROTECTED]'checkbox']").click(function(){
> if ($(this).is(":checked")){
> $(this).siblings("ul").hide("slow");
> } else {
> $(this).siblings("ul").show("slow");
> }
> });
> });
>
> </script>
> </head>
> <body>
> <ul>
> <li><input type="checkbox" name="checkboxA1">checkboxA1
> <ul>
> <li><input type="checkbox"
> name="checkboxA1_1">checkboxA1_1</li>
> <li>
> <input type="checkbox"
> name="checkboxA1_2">checkboxA1_2
> <ul>
> <li><input type="checkbox"
> name="checkboxA1_2_1">checkboxA1_2_1</
> li>
> <li><input type="checkbox"
> name="checkboxA1_2_2">checkboxA1_2_2</
> li>
> </ul>
> </li>
> <li><input type="checkbox"
> name="checkboxA1_3">checkboxA1_3</li>
> </ul>
> </li>
>
> <li><input type="checkbox" name="checkboxB1">checkboxB1
> <ul>
> <li><input type="checkbox"
> name="checkboxB1_1">checkboxB1_1</li>
> <li>
> <input type="checkbox"
> name="checkboxB1_2">checkboxB1_2
> <ul>
> <li><input type="checkbox"
> name="checkboxB1_2_1">checkboxB1_2_1</
> li>
> <li><input type="checkbox"
> name="checkboxB1_2_2">checkboxB1_2_2</
> li>
> </ul>
> </li>
> <li>
> <input type="checkbox"
> name="checkboxB1_3">checkboxB1_3
> <ul>
> <li><input type="checkbox"
> name="checkboxB1_2_1">checkboxB1_3_1</
> li>
> <li><input type="checkbox"
> name="checkboxB1_2_2">checkboxB1_3_2</
> li>
> </ul>
> </li>
> </ul>
> </li>
>
> </ul>
> </body>
> </html>
>
> This should work for what you wanted, changed the event to click as
> Whalin (thx for the reminder, had forgotten abt that) mentions.
> //Kristinn
>
--
View this message in context:
http://www.nabble.com/Loop-Checkbox-Action-Question-tf3246372.html#a9074580
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/