JavaScriptでselectのvalueを取得する方法

参考コード:
var obj = document.getElementByIdx_x(”cftSelect”);
var index = obj.selectedIndex;
var text = obj.options[index].text;
var value = obj.options[index].value;

方法1
$('#cftSelect option:selected’).text();
$('#cftSelect option:selected’) .val();
$(“#cftSelect “).get(0).selectedIndex;

方法2
$(“#tesetSelect").find(“option:selected").text();
xxx.val();
xxx.get(0).selectedIndex;

JavaScript

Posted by arkgame