Hi, Can anyone help with the following? With JQuery, I can't
successfully grab the selected value from a drop-down. The alert just
shows an empty message. At least it is not showing undefined (as it
was for my other attempts - you can see what these were from the
commented out code), but I would expect it to display one of the
values One-way, Reciprocal or Other. Perhaps I have to do some
conversion on the result. Your contributions to this post will be
greatly appreciated.

In my HTML I have:

<select name="dllViewSelector"
                            onchange="showSelectedView(this, allViews, 
allSections,4,10)">

            <option id="oneway_4" value="one" selected="selected">One-
way</option>
            <option id="recip_4" value="two">Reciprocal</option>
            <option id="other_4" value="three">Other</option>
                    </select>
.
.
.
<span id="Add_0" class="actionOptAdd"> <input type="button"
name="btnOk_AddToProject_0" class="button-click-grey" value="Add to
Project" /></span>
.
.
.
And in my JQuery I have ....

                $(".actionOptAdd").bind("click",
                        function()
                        {
                                p_viewSelector=$("#dllViewSelector 
option:selected").text();
                                alert(p_viewSelector);
// Also get blank message for:
//                              p_viewSelector=$("#dllViewSelector 
option:selected",this).text
();
// (Also tried - getting undefined as a result)
//                              
p_viewSelector=$("#dllViewSelector").selectedIndex;
//                              
p_viewSelector=$("#dllViewSelector").attr("selectedIndex");

Reply via email to