Is there a way to add an img tag without an image, but with a placeholder tag or attribute, or using css for testing purposes: activate javascript or css etc.
Set an img src placeholder for testing
7.1k Views Asked by Guy Louzon At
3
There are 3 best solutions below
2
On
You can use: https://placeholder.com/
Simply enter the dimensions and you will be good to go. Eg: https://via.placeholder.com/350x150
You can then add CSS or manipulate this with JS
2
On
Yes, it is possible. Here is an example:
(function($) {
$(document).ready(function() {
$('#path').change(function() {
$('#img').attr('src', $(this).val());
});
});
})(jQuery);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Image path: <input id="path" value="https://www.chatelaine.com/wp-content/uploads/2018/10/Black-Panther-chadwick-boseman-e1539272923602-810x608-1539273014.jpg" />
<img src="" alt="Image not loaded" id="img" />
You can use base64 image
please go through following links for more information and also check code snipet
Codepen Demo
base 64 tutorial