navigation
JQuery

Get filename of image jQuery?

| | Html , JavaScript , JQuery

In this tutorial I will show you how to get the filename of the image using jQuery.  Split the path of the image using the slash('\') and get the filename with some logic.

<img id="Preview" src="~/Uploads/preview.jpg" alt="Preview..." />
var preview =document.getElementById('Preview');

var src=     preview.src.split('/');
var filename = src[src.length- 1];

get filename of image jQuery