Get image src javascript:
In this article I will show you how to get the src attribute of the image and save the path.
<img id="example" src="/images/example.png">
Solution:
To get the path of the picture using the getAttribute.
var path = document.getElementById('imgBannner').getAttribute("src");
$('#Path').val(path);
To get the absolute path document.getElementById("imgBanner").src will return like this,
http://www.example.com/images/example1.jpeg
Post your comments / questions
Recent Article
- OSError: cannot open resource - Python
- Python read file line count
- How to Encode & Decode using Base64 in Python?
- Unspecified error-The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support.
- How to generate a Captcha verification code image with Python?
- How to show an image using path python PIL?
- How to remove Background from the images using Python?
- Python generate QR code image
Related Article