Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

problem getting a select tag value

Posted on 2013-05-10
3
Medium Priority
?
204 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
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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/
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…
Suggested Courses

885 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