How should I get an form input selected value using jQuery
<form:select path="amtAppMonitResltVO.monitStat" id="amtAppMonitResltVO.monitStat" cssClass="state">
<option value="">선택</option>
<form:options name="monit" items="${apps}" itemValue="subCd" itemLabel="subCdNm" />
</form:select>
<img src="<c:url value='/resources/img/read.png'/>" class="read" id="appStatSearch"></td>
You just need get the .val() of the amtAppCollInfoVO_mkType select input:
var some_var = $('#amtAppCollInfoVO_mkType').val();
For pure Javascript just switch .val() to .value
Note that your current option does not have a value.
Note that since you have the . in your id you have to add double \ to your Javascript code:
<script>
$(function() {
$('#amtAppMonitResltVO\\.monitStat').on('click', function() {
var moniStat = $('#amtAppMonitResltVO\\.monitStat').val();
console.log(moniStat);
})
})
</script>
Credit goes here for this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With