I need to get the value from a checkbox which is not hidden.
Here is my HTML & JQuery code
$(document).ready(function() {
var maanu = $('.form').find('input[type=checkbox]:checked').filter(':first').val();
alert(maanu);
});
.hide {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class='form'>
<input class="bills hide" type="checkbox" value="01" checked="checked" />
<br />
<input class="bills" type="checkbox" value="02" />
<br />
<input class="bills" type="checkbox" value="03" checked="checked" />
<br />
<input class="bills " type="checkbox" value="04" checked="checked" />
<br />
<input class="bills " type="checkbox" value="05" />
<br />
<input class="bills " type="checkbox" value="06" />
<br />
<input class="bills " type="checkbox" value="07" />
<br />
<input class="bills " type="checkbox" value="08" />
<br />
</div>
DEMO
Use the :visible
selector:
$('input:checkbox:checked:visible:first').val();
Try - http://jsfiddle.net/xgQVG/6/
$(document).ready(function(){
var maanu = $('.form').find('input[type=checkbox]:checked:not(:hidden)').filter(':first').val();
alert(maanu);
});
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