Это видео недоступно.
Сожалеем об этом.

How To Change an Image With jQuery

Поделиться
HTML-код
  • Опубликовано: 16 ноя 2017
  • Don't forget to like and subscribe for regular web development tips to starting your career as a Junior Developer!
    Find out more at www.juniordeve...
    Like the Facebook page at: / juniordevelopercentral
    Follow me on Twitter: / codebubb
    ----
    Check out the full article here: www.juniordeve...
    So there are some times when you might want to dynamically change an image on your page. Perhaps you need to update an icon based on some user input from a button click for example.
    You can do this pretty easily with a bit of JavaScript but if you have jQuery loaded on to your page already, it's even easier!
    In this video you'll learn how to use a simple jQuery statement to select an image element on a page and change it to another one.
    You will also learn how to connect this behaviour to an event like a button press.
    Related videos:
    How to install jQuery: • Video Channel Handle @codebubb

Комментарии • 4

  • @MegaAvio92
    @MegaAvio92 3 года назад +1

    Nice! I have only one question once the image is changed how can you go back to the original one?

    • @codewithbubb
      @codewithbubb  3 года назад

      You would need to keep track of the previous img src value either in a temporary variable or possibly in local storage if you want to persist the behaviour across page reloads. Hope that helps!

  • @rangabharath4253
    @rangabharath4253 3 года назад +1

    awesome

  • @rudrakshairon1087
    @rudrakshairon1087 4 года назад

    Not working for me ☹️