How can I remove the indent on TextBox after an onclick event? (ASP.NET)

Viewed 89

So, I created an "onclick" event on my ASP.NET TextBox:

<asp:TextBox ID="txtStudentNo" runat="server" onclick="txtStudentNo_Clicked()"></asp:TextBox>

The function inside the script tag is as follows:

  function txtStudentNo_Clicked() {      
  document.getElementById("lblValidation").style.display = "none"; }

The onclick event is working but when I do click on the textbox, there's an indention, how can I remove it? I am still looking for ways but just in case someone answer me here, thank you in advance!

1 Answers

UPDATE!!!

Sorry for the inconvenience, I already got the answer, I just have to use "TextBox.value.trim();"

        function txtStudentNo_Clicked() {
            txtStudentNo.value = txtStudentNo.value.trim();
            document.getElementById("lblValidation").style.display = "none";
        }

My reference: Removing tab space from text box in Javascript

Related