wht is the uses of getElementById and ClientId. [Resolved]

Posted by Oswaldlily under JavaScript on 8/10/2012 | Points: 10 | Views : 4390 | Status : [Member] | Replies : 1
if (document.getElementById('<%=txtUserId.ClientId %>').value == "") {
alert('Username is Mandtory');
return false;
}
a)here wht is the uses of getElementById and ClientId.
wht does it give????
b) why is it returning false?




Responses

Posted by: Vikash on: 8/11/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
if (document.getElementById('<%=txtUserId.ClientId %>').value == "") {
alert('Username is Mandtory');
return false;
}

from your question

<%=txtUserId.ClientId %> this statement is used to access server control ID in asp.net from javascript code & plz use this
<%=txtUserId.ClientID %>
in place of this <%=txtUserId.ClientId %> check difference

i hope now its ok.............

Regards,
Vikash Pathak

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response