Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

problem getting a select tag value

Posted on 2013-05-10
3
Medium Priority
?
201 Views
Last Modified: 2013-05-10
i got the answer to this question: the question

in the same table i have a select menu with its option:
<select name="prod_opt" class="thetype">
<option value="+">+</option>
<option selected="selected" value="-">-</option>
</select>

Open in new window


now i need to get the selected values.

so according to the answer i got i tried this:
                    $('select.thetytpe', 'div.optvalis > table.optiontable').each(function() {
                       
                        optvaltype +=  $(this).val();
                        alert(optvaltype);
                    });

Open in new window


but i do not get anithing, even not an error.

any idea?
0
Comment
Question by:derrida
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
stergium earned 2000 total points
ID: 39154676
Hello
did you tried getting the $(this).text() or $(this).html() ?
Actually doing this
$('select.thetype').val() you get the selected value. By the way you have a typo on your selection $('select.thetytpe', instead of $('select.thetype',

hope that helps
0
 
LVL 1

Author Closing Comment

by:derrida
ID: 39154691
what an idiot i am, it was the typo
0
 
LVL 13

Expert Comment

by:stergium
ID: 39154692
dont worry. many of us (including me) have spended hours on a missed character..
Glad that you worked it out.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question