Reputation: 8628
How do I do this (but in a way that works):
$("MyElem").get("[id$='Date']").datepicker();
Essentially I'm trying to select all elements that end with the word "Date" in the id within the context of a given parent element.
So this should be interpreted as:
Upvotes: 1
Views: 80
Reputation: 35822
Why not using find
method:
$('#myelem').find('[id&=Date]').datepicker();
Or why not using a better selector:
$('#myelem *[id$=Date]').datepicker();
Upvotes: 2
Reputation: 816322
Use find
[docs]:
$(elementReference).find("[id$='Date']").datepicker();
where elementReference
is either a DOM element or a selector. If it already is a jQuery object, then just do elementReference.find(...
.
Upvotes: 2