I'm having a javascript code which takes the field/control id and checks whether it contain alphabets or not. This javascript code can be reused for many other similar fields.
So i'm passing the "id" of the control while calling the javascript function. This was working fine too.
Now when i added a master page to the web page, the ID of the control in the content page will get appended with a clientID. As because of this when i pass the control ID while calling the script function, unable to find the control as it is appended with client ID.
I dont want to repeat the .js code for each control separately, which has the same functionality.
If i directly give the field name in the .js then its working fine.
Expand|Select|Wrap|Line Numbers
- <script type="javascript">
- function checkAlpha(FieldID)
- {
- var txt = document.getElementById('<%=txtUserName.ClientID%>').value;
- alert(txt)
- }
- </script>
How to append this FieldID in javascript, Please help me.
Thanx in Advance,
Vigneshwarie