index of a selected item in a list
based on the code below, when a radio is clicked, how can i tell if it was the first, second, third or fourth in the list (using jquery functions, not string compares against values)? feel like it should be obvious...
- <html>
- <head>
- <script src="js\jquery-1.3.2.min.js" language="javascript" id="javascript"></script>
- <script>
- $().ready( function() {
- $(':radio').click(function(){
- // how do i know which radio?
- alert($(this));
- });
- });
- </script>
- </head>
- <body>
- <div id="whatever">
- <input type="radio" name="e" value="d" checked>answer<br />
- <input type="radio" name="e" value="b">answer<br />
- <input type="radio" name="e" value="a">answer<br />
- <input type="radio" name="e" value="e">answer<br />
- </div>
- </body>
- </html>