By definition, there can only be one control on a page with a given ID.
This statement set the value of a single control:
document.getElementById("ctl00_phPageContent_dtmVisitChinaFrom_txtSkipValidation").value = "1";
Why is the “[0]” necessary?
$("#ctl00_phPageContent_dtmVisitChinaFrom_txtSkipValidation")[0].value = "1";
When you do this:
Or
You are accessing actual DOM element which has
valueproperty available.It isn’t necessary if you use
val()method of jQuery instead:So
[index]part is necessary when you want to access native methods/properties of elements not otherwise.