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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -