My problem is that i have a onClick on my TextBox, which sets the value to nothing. Like this:
<asp:TextBox ID="TextBox1" OnClick="document.getElementById('MainContent_TextBox1').value = '';"></asp:TextBox>
So if the i click on the next TextBox there is no problem, but if i click in the panel the value is set to “”, after just having typed the password and clicking.
Im allready using onFocus event of all my TextBoxes, to keep track of which element had last focus (cause im using ajax updatepanels).
So my question is, is it possible to only fire the OnClick, if the click is in the TextBox?
Edit:
Here is a link to the full code of my panel:
http://pastebin.com/Ujvy26wH
Line: 22-35 is what im refering to with this question.
No, it’s not possible. HTML Input text elements don’t have onclick() events. You can fake them through other means. You have
blur()oronkeyup(), to give you 2 examples, that you can use to perform certain actions on input text elements.