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');
}