click on jquery text field

Asked

Viewed 87 times

0

How do I stop as soon as my page starts, a click is given in a text field?

I want to do with jQuery

  • When you say "click" wouldn’t that be "Focus"? That is, the user can type anything without the need to click on the input, since the focus is already assigned to the input.

  • not the . click even, I am having a problem in the login and password field, when starting the site, the place-Holder of the fields go up to give place to the typed text, however the password field is not going up, only when a click on the field the effect happens, it happens that who leaves saved user and password and the fields already comes filled in then it was not given that "click", then it comes over the text, I do not know if it managed to understand kkkk

  • You’re using the materializecss?

  • 1

    Post your code so we can understand and simulate your problem. Search by $("#campo").trigger("click"); maybe I can help you http://api.jquery.com/trigger/

  • Apparently you’re using Materialize right? It is easier for you to try to solve pq the framework is not going up the label (placeholder), than to do a function to go up the label. Only the password field is not going up or login tbm? On the site of Materialize I made a test and it worked. I clicked the input went up the label and then I filled it, then I went to another page, I went back and the fields were filled and with the label already on top, there would be some error in your code?

  • Then Leandro, I do not understand the Login works normally, as soon as I run the site, the user label goes up because the field already comes filled in, but the password does not go up, only after clicking inside the text field... There is no error in the code because I did not change anything, I just copied and pasted the html ready. I am not using materialize no, I am using this example https://colorlib.com/etc/lf/Login_v2/index.html

  • I took a look at the link, as you are using it, is a plugin?

  • If you analyze, click on the link, fill in the user and send a and then click back, the label will be on top of the contents typed also ta getting to me, I do not know if it would be a browser bug but I believe that not

  • Yes true, so why are you using this? Since you want to use this effect in the form use Materiallize.

Show 4 more comments

1 answer

1


Arthur if you can use css frameworks for the application of to use thus with Materiallize:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" rel="stylesheet"/>

<div class="row">
    <form class="col s12">
      <div class="row">
        <div class="input-field col s6">
          <input id="icon_prefix" type="text" class="validate">
          <label for="icon_prefix">First Name</label>
        </div>
        <div class="input-field col s6">
          <input id="icon_telephone" type="tel" class="validate">
          <label for="icon_telephone">Telephone</label>
       </div>
     </div>
   </form>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.