In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "jquery can judge whether img is empty", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "jquery can judge whether img is empty" this article.
Jquery can determine whether img is empty or not. The value of the img tag is controlled by the src attribute; you only need to use the "$(" img ") .attr (" src ") = ='" statement to determine whether the value of the img src attribute is equal to the empty string to determine whether the img is empty, if so, and vice versa.
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
Jquery can determine whether img is empty or not.
The img tag is used to embed an image into a web page, and its value is controlled by the src attribute. The src property specifies the URL in which the image is displayed.
You just need to determine whether the src attribute has a value.
The method of judgment:
Use the attr () method to get the src attribute value of the picture
Just judge whether the attribute value is an empty string.
$(function () {$("button") .click (function () {var img = $("img") .attr ("src") If ($("img") .attr ("src") = =') {alert ("img is empty");} else {alert ("img is not empty") })}) img {width: 200px; border:1px solid # FF0000 }
Whether img is empty
If the src property has no value:
The above is all the contents of the article "can jquery judge whether img is empty or not". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.