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

19/Dic/2020 2871

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

Links:

Comentarios

  1. 빅카지노 [#]

    Hi there, everything is going nicely here and ofcourse every one is sharing
    data, that’s actually good, keep up writing.

  2. rackspace domain registration [#]

    Hey There. I discovered your weblog using
    msn. That is a very neatly written article.
    I will be sure to bookmark it and return to learn extra of your helpful information. Thanks
    for the post. I will certainly comeback.

  3. dự đoán keno [#]

    Hi! I’m at work browsing your blog from my new iphone 3gs!
    Just wanted to say I love reading through your blog and look
    forward to all your posts! Carry on the superb work!

  4. drugs com [#]

    This piece of writing gives clear idea in favor of the new visitors of blogging, that
    truly how to do running a blog.

  5. 사무실의 친구 [#]

    Howdy! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me.
    Anyhow, I’m definitely happy I found it and I’ll be bookmarking and checking
    back often!

  6. indian online casinos [#]

    Keep on working, great job!

  7. 카지노 [#]

    Very great post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed surfing
    around your weblog posts. In any case I’ll be subscribing on your rss feed
    and I’m hoping you write again soon!

  8. Tedblabs [#]

    cost of cialis generic

  9. jeetwin casino [#]

    Admiring the hard work you put into your site and in depth information you provide.

    It’s good to come across a blog every once in a while that isn’t the same outdated rehashed information. Fantastic read!
    I’ve saved your site and I’m adding your RSS feeds to my Google account.

  10. 메리트카지노 [#]

    Hello, of course this piece of writing is in fact fastidious and I have learned lot
    of things from it regarding blogging. thanks.

  11. 10cric register [#]

    Good post! We are linking to this particularly great article
    on our site. Keep up the great writing.

  12. 더킹사이트 [#]

    I think this is one of the most vital info for me. And i am
    glad reading your article. But wanna remark on few general
    things, The site style is wonderful, the articles is really great : D.

    Good job, cheers

  13. 더킹카지노 [#]

    Thank you for any other informative web site. The place else may just I get that kind of
    info written in such a perfect method? I have a challenge that I am simply now operating on, and I’ve
    been on the look out for such info.

  14. live casino [#]

    Hello there! This is kind of off topic but I need some guidance from an established blog.
    Is it tough to set up your own blog? I’m not very techincal but I
    can figure things out pretty fast. I’m thinking about creating my own but I’m not sure where to start.
    Do you have any tips or suggestions? Thanks

  15. 더킹카지노 [#]

    Currently it appears like Movable Type is the preferred blogging platform available
    right now. (from what I’ve read) Is that what you are using
    on your blog?

  16. zortilo nrel [#]

    Its excellent as your other content : D, regards for posting.

  17. Teoblabs [#]

    provigil from canada

  18. đánh bài [#]

    Hi! I know this is kind of off topic but I was wondering
    which blog platform are you using for this website? I’m getting fed up of WordPress because I’ve had issues with hackers
    and I’m looking at options for another platform.

    I would be awesome if you could point me in the direction of a good platform.

  19. 모나코 카지노 [#]

    My spouse and I absolutely love your blog and find a lot of
    your post’s to be just what I’m looking for. can you offer guest writers to write content to suit your needs?

    I wouldn’t mind producing a post or elaborating on a
    lot of the subjects you write related to here.
    Again, awesome web log!

  20. 원엑스벳 [#]

    You actually make it seem really easy along with your presentation but I to find
    this topic to be actually one thing that I feel I would never understand.
    It kind of feels too complicated and very vast for me.
    I am taking a look forward to your next publish, I’ll attempt to get the hold of it!

  21. 카지노사이트 [#]

    Your style is really unique compared to other folks I have read stuff from.
    I appreciate you for posting when you have the opportunity, Guess I will just book mark this web site.

CSSLab