I've some input boxes where if it's value is other than 1,I need to show a popover saying it is invalid for that particular input.
My code
<br/>
<br/>
<br/>
<input type="text" class="check" />
<input type="text" class="check" />
<input type="text" class="check" />
<input type="text" class="check" />
<input type="button" id="Save" value="Save" />
JavaScript
$(document).ready(function() {
$("#Save").click(function() {
$(".check").each(function() {
$val = $(this).val();
if ($val != 1) {
$(this).popover({
content: "Invalid"
});
}
})
})
})
You are initializing the .popover
plugin, but you are not telling it to show
.
Just do this:
$(this).popover('show');