asp.net mvc - How do you add jquery animation to mvc 2 rendered controls? -
have editor template can rendered 0 n times on given page:
<%@ control language="c#" inherits="system.web.mvc.viewusercontrol<newemployee.models.requestedaccessviewmodel>" %> <fieldset style="display: inline;"> <legend> <%: model.description %></legend> <div class="editor-label"> <%: html.labelfor(model => model.requested) %> <%: html.checkboxfor(model => model.requested)%> </div> <div class="editor-field"> <%: html.textareafor(model => model.comments) %> </div> <%: html.hiddenfor(model => model.description) %> <%: html.hiddenfor(model => model.id) %> </fieldset>
what i'd 'comments' text area hidden initially, , slide down view when check box hit, , slide out if checkbox turned off again.
i know how traditinal asp.net, @ loss mvc2.
use jquery function this
$(document).ready(function () { $("div.editor-field").hide(); $("input:checkbox").click(function () { if ($(this).attr("checked")) { $("div.editor-field").show(); } else { $("div.editor-field").hide(); } }); });
Comments
Post a Comment