user4227915
user4227915

Reputation:

How to find out the file name with jQuery?

For example, I am executing "index.html"

Something like this:

var filename = $.getFileName();

alert(filename);

Is it possible to get "index.html" as result in alert?

Upvotes: 0

Views: 87

Answers (1)

Jack hardcastle
Jack hardcastle

Reputation: 2875

var name = window.location.href.substr(window.location.href.lastIndexOf("/")+1);

Upvotes: 1

Related Questions