c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
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];