Doing complex queries with jQuery -


how query jquery div element visible, has z-index > 0 , id != "".

i raw linear search using document.getelementsbytagname have been told it's excessively performance-impacting. on page 400+ divs takes quite lot of time perform.

somebody told me jquery can perform more complex queries. possible?

please bear in mind have absolutely no control on ids of these popup divs can't work on "well-known" ids.

thank you.

jquery features very rich set of selectors (nearly of css3 , few extras). combined handy filter function, can useful things:

var divswithzindexandid = $('div:visible[id!=""]').filter(function() {     return parseint(this.style.zindex, 10) > 0; }); 

that looks @ z-index on element's inline style. if need computed style, use css.

var divswithzindexandid = $('div:visible[id!=""]').filter(function() {     return parseint($(this).css("z-index"), 10) > 0; }); 

(both style.zindex , css return strings, hence parseint. javascript automatically make number out of anyway, using parseint lets me clear radix should applied.)


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -