jquery - Getting and manipulating product ID -
i want clarify proper way getting , manipulating product id. here attempt:
html:
<div data-product-id="100"></div>
script:
var pid = $(this).attr('data-product-id'); $('#product_' + pid).css('display', 'none');
is there better way $('#product_' + pid)
?
why not like:
$('#product_id').hide();
but if insists:
$('#product_' + $(this).data('product-id')).hide();
Comments
Post a Comment