I have div in my View
<div class="control-group" id="Phone"></div>
and I need to add code inside with jQuery script.
I tried this
@section Scripts
{
<script type="text/javascript">
$("select#Role").change(function () {
if ($(this).val() == "2") {
$("div#Phone").html('<span class="control-label">* Phone:</span>
<div class="controls">
@Html.TextBoxFor(m => m.PhoneNumber)
@Html.ValidationMessageFor(m => m.PhoneNumber, null, new { @class = "text-error" })
</div>');
} else {
}
});
</script>
}
but I got a lot of errors.
What's wrong and how to fix that?