I'm trying to create a link that just triggers a javascript function with parameters set by my mvc model. I have something that looks like this
<a onclick="$('foo_@Model.bar').toggle()"></a>
However this literally makes the onclick element 'foo@Model.bar' instead of printing the contents of Model.bar. How do I escape the Html without altering it?
Just add brackets, tested it and works fine:
Just add parenthesis: