I have a #pdfcontainer which is inside divs #main and #pdfmain. I'm using a variable, because I use the same div many times:
var $pdfcontainer = $('#main #pdfmain #pdfcontainer');
Inside the #pdfcontainer I have #delete which I want to access for various reasons. So how do I get it using the variable and without typing the whole $('#main ...') all over again? I don't just want to use selector $('#delete') because on my site it's much slower that way.
Thnx already!
- Antti
#delete
as a first step anyway (and then checking to make sure it's got the right lineage). What is it about your site that makes looking up an ID on its own somehow slower than looking it up and then walking the lineage?id
values must be unique on a page: w3.org/TR/html5/elements.html#the-id-attribute If you want to give the same name-like-thing to multiple elements, you usually want aclass
.