I have an Id City on page which is basically a model property. I want to set it as null. I am trying this to achieve it:
$("#City").val(null);
But it is not setting the value to null.
I have an Id City on page which is basically a model property. I want to set it as null. I am trying this to achieve it:
$("#City").val(null);
But it is not setting the value to null.
If you are trying to set/remove Id
$("#City").attr("id","");
or use removeAttr()
If you are trying to set the value inside that ,
$("#City").val("");
You can remove Id using jQuery prop() or attr() methods like this :
$('#City').prop('id', null);
or like this :
$('#City').attr('id', null);
Just in case :