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>
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.
2. In the <script> tag in index.html, enter the jquery code: <code>$('img').attr('src', ' small3.png');. </script>
#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.
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!