troubleshooting Question

Bootstrap - clear input

Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America asked on
JavaScriptCSSASP.NETBootstrap
4 Comments1 Solution549 ViewsLast Modified:
I am trying to use Bootstrap 3 and wanting to add clear on each textbox. It is not working. How should I fix it?

Javascript
    
            $(document).ready(function(){
                $(".TextBox").keyup(function(){
                    $(this).siblings(".searchclear").toggle(Boolean($(this).val()));
                });
                $(".searchclear").toggle(Boolean($(".TextBox").val()));
                $(".searchclear").click(function(){
                    $(".searchinput").val('').focus();
                    $(this).hide();
                });
            });
            
            
            
CSS
            
             .searchinput {
    width: 200px;
}

.searchclear {
    position:absolute;
    right:5px;
    top:0;
    bottom:0;
    height:14px;
    margin:auto;
    font-size:14px;
    cursor:pointer;
    color:#ccc;
}



HTML

<div class="btn-group">
 
   <asp:TextBox ID="UserID" runat="server" class="form-control" placeholder="UserID" autofocus></asp:TextBox>
  <span id="searchclear" class="searchclear glyphicon glyphicon-remove-circle"></span>
</div>

<div class="btn-group">

   <asp:TextBox ID="Password" runat="server" TextMode="Password" class="form-control" placeholder="Password"></asp:TextBox>
  <span id="searchclear" class="searchclear glyphicon glyphicon-remove-circle"></span>
</div>
ASKER CERTIFIED SOLUTION
sajayj2009

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros