如何用jQuery编写购物车商品增删功能?

2026-04-06 11:311阅读0评论SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计89个文字,预计阅读时间需要1分钟。

如何用jQuery编写购物车商品增删功能?

javascriptscript+$(function(){ $(table tr:odd).css(background-color,#f2f2f2);});

<script> $(function(){ $("table tr:nth-child(odd)").css("background-color",'#eee'); $("#chkAll").click(function() { if(this.checked){ $("table tr td input[type='checkbox']") .prop("checked",true); }else{ $("table tr td input[type='checkbox']") .removeAttr("checked"); } }); $("#btnDel").click(function(){ var intL=$("table tr td input:checked:not('#chkAll')").length; console.log(intL); if(intL){ $("table tr td input[type=checkbox]:not('#chkAll')").each(function(index){ if(this.checked){ $(this).parent().parent().remove(); } }) } }) }); </script>

如何用jQuery编写购物车商品增删功能?

本文共计89个文字,预计阅读时间需要1分钟。

如何用jQuery编写购物车商品增删功能?

javascriptscript+$(function(){ $(table tr:odd).css(background-color,#f2f2f2);});

<script> $(function(){ $("table tr:nth-child(odd)").css("background-color",'#eee'); $("#chkAll").click(function() { if(this.checked){ $("table tr td input[type='checkbox']") .prop("checked",true); }else{ $("table tr td input[type='checkbox']") .removeAttr("checked"); } }); $("#btnDel").click(function(){ var intL=$("table tr td input:checked:not('#chkAll')").length; console.log(intL); if(intL){ $("table tr td input[type=checkbox]:not('#chkAll')").each(function(index){ if(this.checked){ $(this).parent().parent().remove(); } }) } }) }); </script>

如何用jQuery编写购物车商品增删功能?