i have the following code where i have a dropdown list (with class="addToList" and followed by a button (Class="addtoButton"):
When i click on the button, i want to grab the current selected value and text from the previous dropdown list.
$(".addToPortalButton").live('click', function (e) {
// grab the previous dropdown list value and text here.
});
what is the easiest way to doing this using jquery.
Here is the html:
<select class="addToList" id="Teams" name="Teams">
<option></option>
<option value="49">Team 1</option>
<option value="22">Team 2</option>
</select>
<input type='button' class="addToButton" value='Add to' />
<select class="addToList" id="Teams" name="Teams">
<option></option>
<option value="49">Team 1</option>
<option value="22">Team 2</option>
</select>
<input type='button' class="addToButton" value='Add to' />
<select class="addToList" id="Teams" name="Teams">
<option></option>
<option value="49">Team 1</option>
<option value="22">Team 2</option>
</select>
<input type='button' class="addToButton" value='Add to' />