Jquery 如何检查项目是否不存在';t存在,并且只更新div数量

Jquery 如何检查项目是否不存在';t存在,并且只更新div数量,jquery,Jquery,单击加号图标和减号图标时,我正在计算并将其添加到myOrderPanel_页脚div中 如果在同一个项目上单击加号图标,我不想增加数量 我如何检查物品是否不存在,然后我只想增加数量 单击加号图标时的示例逻辑 $(document).on('click', '.icon-plus', function (e) { var value = parseInt($(this).closest('div').find('.QtyInput').val()); $(this)

单击加号图标和减号图标时,我正在计算并将其添加到myOrderPanel_页脚div中

如果在同一个项目上单击加号图标,我不想增加数量

我如何检查物品是否不存在,然后我只想增加数量

单击加号图标时的示例逻辑

$(document).on('click', '.icon-plus', function (e) {
        var value = parseInt($(this).closest('div').find('.QtyInput').val());
        $(this).closest('div').find('.QtyInput').val(value+1);
        var currentsellprice =  parseFloat($(this).parent().prev().data('sellprice')); // get the data "price" of item
        var currentquantity =parseInt($(this).closest('div').find('.QtyInput').val());
        $(this).closest('.lastItm_Wrap').find('.Itm_right_aside .sellprice').text(currentsellprice*currentquantity);
        if(currentquantity>=1)
        {
        addquantitytoMyordersfooter();
        var subtotalvalue = parseInt($(".myOrderPanel_footer .subtotal").data('subtotal'));
        subtotalvalue = subtotalvalue + currentsellprice ;
        $(".myOrderPanel_footer .subtotal").data('subtotal',subtotalvalue);
        $(".myOrderPanel_footer .subtotal").text(subtotalvalue)
        }
         displaylogicforfooter();
});

我需要你的建议,我是否应该维护一个全局数组,或者是否有其他可行的解决方案来解决这个问题???

哪个项目不存在,你说的是哪个html元素?你说的“同一时间”是什么意思?每个项目都有一个名为TreeMenu_内容的类,具有唯一的id。例如,这里有两个项目,id为itemcontent703的Item1和id为itemcontent693的Kool。类似吗?