Evento clear de un <input type=»search» />

19/Dic/2020 515

HTML5 hace años incorporó varios nuevos tipos de input, entre ellos el search. Este nuevo input -aparte de semántico- coloca una para borrar el valor ingresado en el input y comenzar de nuevo con la búsqueda.

input search

En sus comienzos este comportamiento fue ignorado por muchos desarrolladores ya que era propietario de Safari (Webkit) pero actualmente con soporte más amplio, me ví en el caso de tener que utilizar este evento clear, con el siguiente resultado: existe un nuevo evento para este input: search.

Con el siguiente simple código veremos su comportamiento:

<input type="search" id="searchbox" />
document.getElementById("searchbox").addEventListener("search", function(event) {
  console.log('search X clicked');

Ver ejemplo



  1. 더킹 카지노 [#]

    Hello! I understand this is kind of off-topic but I needed to ask.
    Does operating a well-established blog such as yours require
    a massive amount work? I’m brand new to blogging however I do write in my diary everyday.
    I’d like to start a blog so I can share my personal experience and thoughts online.

    Please let me know if you have any kind of recommendations or tips for new aspiring bloggers.
    Appreciate it!

  2. 더킹 카지노 [#]

    I must thank you for the efforts you’ve put in penning
    this website. I really hope to see the same high-grade content by you later on as well.
    In truth, your creative writing abilities has encouraged me
    to get my very own website now 😉

  3. https://septcasino.com/ [#]

    Hey there just wanted to give you a brief heads up and let you know
    a few of the images aren’t loading correctly. I’m not sure why but I think its a linking
    issue. I’ve tried it in two different web browsers and both show the same

  4. Otmvsg [#]

    buy prednisone 10mg – prednisone 54899 prednisone over counter

  5. 007 카지노 [#]

    Today, I went to the beach front with my kids. I found a sea shell and gave it to my
    4 year old daughter and said «You can hear the ocean if you put this to your ear.» She put the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is completely
    off topic but I had to tell someone!

  6. Puff Bar [#]

    What i don’t understood is actually how you are not really
    much more neatly-liked than you may be right now. You are so intelligent.
    You know thus considerably in the case of this matter, produced
    me in my view believe it from numerous varied angles.
    Its like women and men aren’t fascinated until it is one thing to accomplish with
    Lady gaga! Your own stuffs excellent. Always handle it up!

  7. Payday loans [#]

    I do not even know how I ended up here, but I thought
    this post was great. I don’t know who you are but certainly you are
    going to a famous blogger if you aren’t already 😉 Cheers!

  8. 바카라사이트 [#]

    I am in fact happy to read this web site posts which carries lots of useful information, thanks for
    providing such data.

  9. SM 카지노 [#]

    Thanks for sharing such a good thought, piece of writing is pleasant, thats why i have read it fully

  10. 카지노 사이트 [#]

    I am not sure where you’re getting your info, but good topic.
    I needs to spend some time learning more or understanding
    more. Thanks for wonderful information I was
    looking for this info for my mission.

  11. what is cialis 5mg used for [#]

    Buy brand cialis online usa what is cialis 5mg used for cialis at a discount

  12. generic cialis fedex [#]

    Buy cialis with american express generic cialis fedex cialis price drop

  13. 더킹카지노 [#]

    Hello, Neat post. There’s a problem with your web site in internet explorer, may
    test this? IE nonetheless is the market leader and a
    big element of people will miss your great writing because of
    this problem.

  14. canadian pharmacy tampa [#]

    How to report someone selling prescription drugs canadian pharmacy tampa Ditropan

  15. 우리카지노 [#]

    I was wondering if you ever thought of changing the
    layout of your site? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content
    so people could connect with it better. Youve got
    an awful lot of text for only having 1 or 2 pictures.

    Maybe you could space it out better?

Deja tu Comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *