We launched new forums in March 2019—
join us there
.
In a hurry for help with your website?
Get Help Now!
Back to MODX.com
Forums
Docs
Revo Issues
Blog
My Forums
General
Webworker Lounge
Search
[jQuery] How to use with dynamic selectors?
4,205 Posts
dev_cw
Reply #1,
17 years, 7 months ago
I have a script that generates a variable number of instances #id1 #id2 #id3... and so on. How do I code jQuery to work with them dynamically?
$("#id").click(function(){ ...
I’m stumped
Could someone point me in the right direction?
[font=Verdana]Shane Sponagle
|
[wiki] Snippet Call Anatomy
|
MODx Developer Blog
|
[nettuts] Working With a Content Management Framework: MODx
Something is happening here, but you don't know what it is.
Do you, Mr. Jones? - [bob dylan]
171 Posts
etal
Reply #2,
17 years, 7 months ago
I suggest you assign a common class to all the instances and use that in the jQuery selector.
4,205 Posts
dev_cw
Reply #3,
17 years, 7 months ago
Good idea,
but they each need a unique ID because I am attaching a date UI widget for each one and it requires a unique id
I’ll be jazzed, it actually works with the class selector. I’ll test this some more but it may have resolve my problem. Thanks
[font=Verdana]Shane Sponagle
|
[wiki] Snippet Call Anatomy
|
MODx Developer Blog
|
[nettuts] Working With a Content Management Framework: MODx
Something is happening here, but you don't know what it is.
Do you, Mr. Jones? - [bob dylan]