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

asp.net mvc 3 - Using mvc3, I need to add a username/password to the sql connection string at runtime -

kineticjs - draw multiple lines and delete individual line -

thumbnails - jQuery image rotate on hover -