Adsense
Popular Posts
- Code update from PHP 7.4 to PHP 8.1 - PhpSpreadsheet
- MySQL workbench -"Could not decrypt password cache"
- Code update from PHP 7.4 to PHP 8.1 - Worksheet/Iterator.php
- Rendering HTML tags inside textarea
- axios handle blob type data
- Unix Utils and wget in Windows
- increase mysql query speed
- Setup vi syntax for PHP
- Get WAMP running on EC2
- EXCEL return to the next line in the same cell
Wednesday, November 21, 2018
Get the dropdown list value and list in JQuery
I have a dropdown list class TaList in a column in a table.
To get the option value of dropdown list in JQuery:
row3.find('td.TaList select').val();
To get the selected text of dropdown list in JQuery:
stakeholder_name1 = row3.find('td.TaList :selected').text();
More codes:
$('div.ajax_list').find("#defaultTable").find('tr').each(function() {
if($(this).find('.swap_option').attr('checked') == 'checked') total += 1;
var row3= $(this);
if(total==1 && $(this).find('.swap_option').attr('checked') == 'checked'){
courses_offered_id1=row3.find("input.courses_offered_id").val();
stakeholder_id1 = row3.find('td.TaList select').val();
stakeholder_name1 = row3.find('td.TaList :selected').text();
section1 = row3.find('.TutSection').html();
assignedID1 = row3.find('.assignedID').val();
}
if(total==2 &&$(this).find('.swap_option').attr('checked') == 'checked'){
courses_offered_id2=row3.find("input.courses_offered_id").val();
stakeholder_id2 = row3.find('td.TaList select').val();
assignedID2 = row3.find('.assignedID').val();
stakeholder_name2 = row3.find('td.TaList :selected').text();
section2 = row3.find('.TutSection').html();
}
});
Labels:
dropdown list,
jQuery
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment