Home > Web Front-end > JS Tutorial > body text

How to put jquery value into src of img tag

coldplay.xixi
Release: 2020-11-30 11:45:33
Original
2855 people have browsed it

How to put the value of jquery into the src of the img tag: first create a new html file and introduce jquery; then enter the jquery code in the [<script>] tag in [index.html]; Finally, the browser can run the [index.html] page. </script>

How to put jquery value into src of img tag

The operating environment of this tutorial: Windows 7 system, jquery version 3.2.1. This method is suitable for all brands of computers.

How to put the jquery value into the src of the img tag:

1. First, open the html editor and create a new html file, for example: index.html , and introduce jquery.

How to put jquery value into src of img tag

2. In the <script> tag in index.html, enter the jquery code: <code>$('img').attr('src', ' small3.png');. </script>

How to put jquery value into src of img tag

#3. The browser runs the index.html page. At this time, jquery is used to successfully put the image address into the src of the img tag.

How to put jquery value into src of img tag

Related free learning recommendations: javascript (video)

The above is the detailed content of How to put jquery value into src of img tag. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template