to get the text:
http://stackoverflow.com/questions/1643227/jquery-get-selected-text-from-dropdownlist
$('#yourdropdownid').children("option:selected").text();
which is an optimization of
$("#yourdropdownid option:selected").text();
for completeness, to get the value:
<script>
var submit_product_edit_form = function() {
// create a form hidden input with the value of true.
$('<input>').attr({
type: 'hidden',
name: 'hidden_lang_change',
value: true,
}).appendTo('#product_view_form');
// submit POST with it.
$("#product_view_form").submit();
};
$("#id_lang").change(function() { // If Bulk Action selectbox OnChange
submit_product_edit_form();
});
</script>
2
<script>
var submit_product_edit_form = function() {
// create a form hidden input with the value of true.
$('<input>').attr({
type: 'hidden',
name: 'hidden_lang_change',
value: true,
}).appendTo('#product_edit_form');
// submit POST with it.
$("#product_edit_form").submit();
};
$("#id_lang").change(function() { // If Bulk Action selectbox OnChange
submit_product_edit_form();
});
</script>
jquery get currently selected text in select box
ReplyDelete