I am trying to get used to the syntax in JQuery when using MVC 2.
I want to copy a phone number from 1 field to another. However the syntax of the line below is wrong;
$("#contractAdministratorContact_Phone").val($("#contactClientContact_Phone").val());
The above fields are defined as
<%: Html.EditorFor(model => model.clientContact.Phone)%>
<%: Html.EditorFor(model => model.contractAdministratorContact.Phone)%>
When I look at the page source, the Ids are contractAdministratorContact_Phone and contactClientContact_Phone
My script I locate at the bottom of my page;
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#chkCopyContact").click(function () {
if ($("#chkCopyContact").is(":checked")) {
alert("in!");
$("#contractAdministratorContact_Phone").val($("#contactClientContact_Phone").val());
}
alert("done!");
})
});
</script>
So what should my JQuery set statement be instead?