My daughter has created a checkbox system for a list. She has also made it so that when you check the checkbox it changes the text decoration to strikethrough.
She can get it to do the strikethrough on existing items, but it doesn't do it to items she has added using the textfield button submit.
My questions are:
1) how do you list two changes (one that changes the text decoration to line-through and at the same time turns the color to red) in the following code:
$(':checkbox').change(function() {
var that = this;
$(this).parent().css('textDecoration', function() {
return that.checked ? 'line-through' : "";
});
});
2) How do you make the checkbox function in 1 work on items that have been added to the list using
HTML:
<p align="center" ><input name="newtext" type="text" id="newtext"/> <em>
Required Field</em></p>
<p align="center"><button id="addbtntd">Tasks</button>
Code:
$('#addbtntd').click(function (){
var text = $("#newtext").val();
$("#tlist").append('<li> <input type="checkbox" name="checkbox" id="checkbox" />'+text+'<button class="delete">Delete</button></li>');
$("#newtext").val('');
});
Thank you very much for your help. She has worked very hard on this assignment and has turned to me to help her with debugging issues. I have background in css and html, but have never done jquery before so I'm struggling to help her!