Using MVC3 Razor within Javascript


<script type="text/javascript">
$(function () {
$("#submitbtn").click(function () {

@if (Some Condition) {

<text>
var checked = $("#frm input:checked").length > 0;
if (!checked) {
alert("Please select at least one object to continue");
return false;
}
</text>

}

});
});

</script>


Get Free Email Updates!

Signup now and receive free offers, discounts & coupon codes

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge