Another 'this' question !
Hi all
Sorry folks it's another 'this' question, I am looking for answers but I'm stuck again.
http://www.ttmt.org.uk/this/
I have a group of drop down list that all call a function. In the function I just want to capture
the value that has been selected.
I'm always getting the first value because I need to capture 'this' value.
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <style type="text/css"> *{ margin:0; padding:0; } #wrap{ margin:50px; } </style> </head> <body> <div id="wrap"> <form method="" action=""> <select class="list" onchange="getList();"> <option value="One">One</option> <option value="Two">Two</option> <option value="Two">Three</option> <option value="Two">Four</option> </select> <select class="list" onchange="getList();"> <option value="Two-One">Two-One</option> <option value="Two-Two">Two-Two</option> <option value="Two-Two">Two-Three</option> <option value="Two-Two">Two-Four</option> </select> <select class="list" onchange="getList();"> <option value="Three-One">Three-One</option> <option value="Three-Two">Three-Two</option> <option value="Three-Two">Three-Three</option> <option value="Three-Two">Three-Four</option> </select> </form> </div> <script type="text/javascript"> function getList(){ //alert($(this, '.list').val()); alert($('.list').val()); } </script> </body> </html>



Reply With Quote




Bookmarks