troubleshooting Question

Enhance function to copy values to fields AFTER current field

Avatar of Rouchie
RouchieFlag for United Kingdom of Great Britain and Northern Ireland asked on
jQuery
5 Comments1 Solution244 ViewsLast Modified:
The following function copies values from a text box to all text boxes on the page that have a particular ID value.  It works well, but I was wondering if it was possible to enhance the logic so that instead of copying the value to ALL textboxes that match the given ID value, to just copy values to all matching text boxes that appear in the DOM after startBox?

function CopyValues(startBox){
		var startboxid = '#' + startBox;
		var level = $(startboxid).val();
		$("input[type='text'][id$='txt_Level']").each(function(){
			if ($(this).val()=='') {
					$(this).val(level);
			}
		});
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
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 5 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