I have a simple select tag on a form <select name="req" id="req' > <option value="1">James Young</option> <option value="2">Kebu Steward</option> <option value="3">Randy Clarke</option> </select> How can I capture the text of the selected item. example suppose "Kebu Steward" was selected by the user how could I capture "Kebu Steward" in one value then break it into two values var f_name = Kebu var l_name = Steward This is my first time with such and issue and I don't know how to approach the problem. Thanks
Found some reading material that helped solve the issue. <script type="text/javascript"> function passVals(){ //used to get text of selected item in select tag reqList = document.getElementById("req"); var full_name = reqList.options[reqList.selectedIndex].text; //separate full name in an array var fl_name = full_name.split(" "); //assign values to parent elements window.opener.document.appts.req_f_name.value= fl_name[0]; window.opener.document.appts.req_l_name.value= fl_name[1]; window.close(); } </script> Code (markup):