traversing from variable in jquery -


i trying traverse variable required destination, but, not. trying 'th' width in 'table'. below code not working. making sense? please. if not, how can traverse variable required point. please?

var tabnamecurr = $("table#refparts");  alert($(tabnamecurr + "thead tr th").eq(5).width()); 

also, have tried below code , working expected.

alert($(tabnamecurr).find("thead tr th").eq(5).width()); 

but, intention need traverse variable, how can achieve that?

your second method should have worked, don't know why isn't , @dhavalmarthak said without $ works since have object of table!

var tabnamecurr = $("table#refparts"); alert(tabnamecurr.find("thead tr th").eq(5).width()); 

i suggest check console errors or whether have 6 th's in table eq(5) refers 6th header!!

fiddle here


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -