|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How do I find a variable (dynamic) div with jQuery?
Hi,
I need to find a div and make changes to it but the name of the div is dynamic. I've tried to place my JS variable named var mydiv into a jQuery reference but it doesn't work. Does anyone know how to make this work? Failing code below: Code:
...inside jquery block...
var mydiv = 'glenn';
$("#" & mydiv ).show();
The intended result would be the same as $("#glenn").hide(); Thanks for your help. |
|
#2
|
||||
|
||||
|
"+" is the concatenation operator in JS, not "&".
Code:
var mydiv = 'glenn';
$("#" + mydiv ).show();
__________________
Spreading knowledge, one newbie at a time. Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions IE7: the generation 7 browser new in a world of generation 8 browsers. Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around. |
|
#3
|
|||
|
|||
|
Thanks. I'm an idiot. Too many languages. I'm working in ASP right now (which I don't do often) and between this and document.write v. response.write, I'm killing myself.
Thanks again1 |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > How do I find a variable (dynamic) div with jQuery? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|