troubleshooting Question

Help using :first

Avatar of Rouchie
RouchieFlag for United Kingdom of Great Britain and Northern Ireland asked on
jQuery
12 Comments1 Solution214 ViewsLast Modified:
I have multiple tables, each containing multiple text fields and links.  When a particular link is clicked, I need to find the first text field that matches a given ID value.
I have this attempt, but it doesn't find the text field.  Any help would be appreciated:

function ReplaceFirstValue(idToClear, startCtrl) {
		var startCtrlId = '#' + startCtrl;
		var firstTextField = $(startCtrlId).parent('table').find("input[type='text'][id$='" + idToClear  + "']:first"); // fails (no error given)
		$(firstTextField).val('Hello');
}
ASKER CERTIFIED SOLUTION
leakim971
Multitechnician
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros