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
Solved

problem getting a select tag value

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress Taxonomy 2 36
Passport Expiry 3 58
How to display div value on input field value in php 11 51
PHP and JQuery Syntax question 4 26
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
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…

789 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