asp.net mvc - Intermingle Javascript and Razor Code -
i have following jquery slider initializer want add simple comma after end of line needs programatically populated.
$(function () { $("#slider").slider({ value: 1, min: 1, max: @model.offer.purchaselimit, <---problematic comma step: 1, slide: function (event, ui){ $("#amount").val(ui.value); } }); });
the comma gets underlined 'syntax error'. guess razor trying interpret comma.
i have tried create variable outside javascript function this:
var purchasemax = @model.offer.purchaselimit; <----problematic semi-colon
but problem becomes semi-colon. do work?
do this:
max: @(model.offer.purchaselimit),
this way scope of razor expression between @(
, )
Comments
Post a Comment