jquery - Set model property from view -



jquery - Set model property from view -

as go on question here: jquery hide , show text input

<div> <input type="button" id="btnnewgroup" value="new group" /> @html.textboxfor(model => model.groupname, new { @id = "newgroup", @style = "display:none" }) </div> <input type="submit" value="send" /> <script type="text/javascript"> $(document).ready(function () { $("#btnnewgroup").click(function () { $("#newgroup").toggle(); }); }); </script>

when click on submit button, want model property groupname right value: if the text input shown property value entered, if text input hidden propery value string "other group".

something like

$('form').submit(function() { if ($('#newgroup').is(':hidden')) { $('#newgroup').val('other group'); } }

jquery model

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -