Accessing Value from Dynamic Dropdown

I have html with a <select> tag, upon selecting a value, jquery loads an html page with a <select> into a <div>.  My problem is getting the selected value from this dropdown since it was created dynamically.  my javascript looks like this:
            $("#requestType").change(function(event) {
                $("#submenu1").load("pages/" + $(this).val() + ".htm");
                $("#submenu1").css("display","inline-block");
            });
So with this I now have a new dropdown with the name of $(this).val() and it loads correctly.  I need to be able to get the selected value from this new dropdown.  I can't see how to do an .change for it.  I'm assuming it's an async issue since it's not available yet in this routine.  Any assist would be appreciated!
kevbob650Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
If you create an element dynamically then bind the event using .on() like so

$('body').on('change', '#requestType', function(event) {
  $("#submenu1").load("pages/" + $(this).val() + ".htm");
  $("#submenu1").css("display","inline-block");
});

Open in new window

0
kevbob650Author Commented:
I still do not see how I can access the on change event of the newly created dropdown, ( $(this).val() )
0
Julian HansenCommented:
I still do not see how I can access the on change event of the newly created dropdown,
You don't, the event is bound to body and when the click happens the check is done to see if the element has the #submenu1 id.

This is the standard way of handling events on dynamically created elements.

Working sample here
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kevbob650Author Commented:
Good answer, just had to get my eyes open - thanks
0
Julian HansenCommented:
You are welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.