Solved

problem getting a select tag value

Posted on 2013-05-10
3
199 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 500 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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

623 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