If I define the text box as follows:
@Html.TextBoxFor(m => m.Contact.HomePhone)
it will generate an input element with id Contact_HomePhone .
Is it possible to get this id in JavaScript without hardcoding Contact_HomePhone ?
This is an example of where I need this id dynamically in JavaScript:
$("#Contact_HomePhone").mask("(999) 999-9999");
(I know how to get property names using reflection, but you still have to hardcode _ to combine Contact and HomePhone .)
javascript c # asp.net-mvc razor asp.net-mvc-4
vlscanner
source share