Reputation: 110
my problem is strange property EmployeePhone in the model has value "+96279000000"
so I pass it for javascript
$("#EmployeePhone").intlTelInput("setNumber", "@Model.EmployeePhone");
but the problem is at rendering time the value appears as
$("#EmployeePhone").intlTelInput("setNumber", "+96279000000");
the expected result should be
$("#EmployeePhone").intlTelInput("setNumber", "+96279000000");
how to solve this?
Upvotes: 1
Views: 734
Reputation: 932
You can try with @Html.Raw(@Model.EmployeePhone);
.
Or:
function initialize() {
var employeePhone= @Html.Raw(Json.Encode(Model.EmployeePhone));
}
...
$("#EmployeePhone").intlTelInput("setNumber", employeePhone);
Upvotes: 2