Try to search your question here, if you can't find : Ask Any Question Now ?

Last segment of URL

HomeCategory: stackoverflowLast segment of URL
Avatargaurav asked 4 months ago

How do I get the last segment of a url? I have the following script which displays the full url of the anchor tag clicked:

$(".tag_name_goes_here").live('click', function(event)
{
    event.preventDefault();  
    alert($(this).attr("href"));
});

If the url is

http://mywebsite/folder/file

how do I only get it to display the “file” part of the url in the alert box?

1 Answers
Best Answer
Avatarnaveen answered 4 months ago
Your Answer

1 + 16 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com