Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142239

How can I read id from jquery variable

$
0
0
 var $div = $('<div/>', {
         css: css,
         id: "testId" + product.id
 });

How can I access this id from this $div..

For now I hardcoded it when fetching from html, like this:

$('#testId_a2732d9e-db81-4c2f-85aa-563856e53ff4').css('background', '');

But I would like to access it directly in my javascript file from this $div

Thanks


Viewing all articles
Browse latest Browse all 142239

Trending Articles