1.通過設定標簽,在js里寫click事件
html:
<div style="margin-left: 77px; background-color: white; line-height: 30px; padding-left: 5px;"> <a class="pro deleteBrand" title="適用季節" href="javascript:void(0);">適用季節 <span class="icon-btn-x">x</span> </a> <a class="pro deleteBrand" title="適用季節" href="javascript:void(0);">適用季節 <span class="icon-btn-x">x</span> </a> <a class="pro deleteBrand" title="適用季節" href="javascript:void(0);">適用季節 <span class="icon-btn-x">x</span> </a> <a class="pro" id="btn-brand-search" title="適用季節" href="javascript:void(0);">更多∨</a> </div>
js:
deleteBrand : function () { $(".deleteBrand").click(function (aa) { $(this).css('display', 'none'); //$(this).parent().css('display', 'none'); }); }
2.在html頁面寫click事件
html:
<div style="margin-left: 77px; background-color: white; line-height: 30px; padding-left: 5px;"> <a class="pro" data-url="nav" title="適用季節" href="javascript:void(0);" onclick="new goodsUpperAndLower.init().deleteBrand(this);">適用季節 <span class="icon-btn-x">x</span> </a> <a class="pro" data-url="nav" title="適用季節" href="javascript:void(0);" onclick="new goodsUpperAndLower.init().deleteBrand(this);">適用季節 <span class="icon-btn-x">x</span> </a> <a class="pro" data-url="nav" title="適用季節" href="javascript:void(0);" onclick="new goodsUpperAndLower.init().deleteBrand(this);">適用季節 <span class="icon-btn-x">x</span> </a> <a class="pro" id="btn-brand-search" title="適用季節" href="javascript:void(0);">更多∨</a> </div>
js:
deleteBrand : function (obj) { //$(obj).parent().css('display', 'none'); $(obj).css('display', 'none'); }
