<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<style>
li{list-style: none;
}
</style>
</head>
<body>
<div>
<h2>Таблица</h2>
<ul>
<li><input type = "checkbox"> кот </li>
<li><input type = "checkbox"> собака </li>
</ul>
<form>
<input type = "text">
<input type = "submit">
</form>
</div>
[js]
<script>
$("div").on("click", "input:submit", function(e) {
var result = $("input:text").val();
$("<li><input type = 'checkbox'>" + result + "</li>").appendTo('ul');
if("input:submit"){
$("input:text").val("");
}
*!*
$("input:checkbox").click(function(e) {
var check = $(this).prop("checked");
console.log(check);
if (check == true) {
$("input:checked").closest("li").css("text-decoration", "line-through");
}
else {
$(this).closest("li").css("text-decoration", "none"); // closest("li")-родитель checkbox
}
*/!*
});
});
$("input:checkbox").click(function(e) {
var check = $(this).prop("checked");
if (check == true) {
$("input:checked").closest("li").css("text-decoration", "line-through");
}
else {
$(this).closest("li").css("text-decoration", "none");
}
}
);
$('form').on('submit', function(e) {
e.preventDefault();
});
</script>
[/js]
</body>
</html>