I am trying to get the selected checkbox text when on change.
Here is my aspx code
<ul class="multiselect-container dropdown-menu">
<li class="">
<a tabindex="0">
<label class="checkbox">
<input type="checkbox" value="1001"> 1001</label>
</a>
</li>
<li class="">
<a tabindex="0">
<label class="checkbox">
<input type="checkbox" value="1111"> 1111</label>
</a>
</li>
<li class="">
<a tabindex="0">
<label class="checkbox">
<input type="checkbox" value="2222"> 2222</label>
</a>
</li>
<li class="">
<a tabindex="0">
<label class="checkbox">
<input type="checkbox" value="3333"> 3333</label>
</a>
</li>
</ul>
Here is my Jquery code what tried
$('.multiselect-container :checkbox').change(function () {
$('.multiselect-container input:checkbox').each(function () {
var sThisVal = (this.checked ? $(this).val() : "");
alert(sThisVal);
});
alert('working');
});
Note
When I run on
js
file, it doesn't show the alert. but when i tried on console. it is working...
Can you tell me answer with reason why it is not working with js file?
Aucun commentaire:
Enregistrer un commentaire