Razor View Engine and jQuery

Posted by rjovic on Stack Overflow See other posts from Stack Overflow or by rjovic
Published on 2010-08-24T11:59:00Z Indexed on 2011/01/05 18:53 UTC
Read the original article Hit count: 236

Filed under:
|

Hi,

does anybody know how to force Razor View engine to print exact line which is under foreach loop. Code follows :

@section head{
<script type="text/javascript" src="@Url.Content("~/Content/Scripts/jquery-1.4.1.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/Scripts/jquery.progressbar.min.js")"></script>

<script type="text/javascript">

    $(document).ready(function() {
        @foreach(var player in Model)
        {
            jQuery("#pb@PlayerID").progressBar();
        }
    });
</script>

}

I tried using $() and jQuery() but in both case razor don't know what to do. Is there any way to force him to print exact this : jQuery("#pb@PlayerID").progressBar(); . I want to have something like this :

$(document).ready(function() {
    $("#pb1").progressBar();
    $("#pb2").progressBar();
    $("#pb3").progressBar();

});

Thank you in advance!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about Razor