I have an input field generated by
<%= Html.TextBoxFor(model => model.Card.ExpiryDate) %>
which leads to html
<input id="Card_Expiry_Date" name="Card.ExpiryDate" type="text" value="">
I also have a javascript function
<script type="text/javascript"> $().ready(function() { $('#Card_Expiry_Date').datepicker({ dateFormat: 'yy-mm-dd' }); </script>
How can I get the input identifier to be generated so that I don't have to hardcode the identifier in my function?
source share