The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> remove extension from file name
Tiff 1998
post May 7 2017, 12:36 AM
Post #1





Group: Members
Posts: 5
Joined: 7-May 17
Member No.: 26,398



Hello,

I have a script that copies the anchor text when I click on a link and copies it to a text input. The problem I have is that I need to remove the file extension before it gets copied.
This is what I have:

CODE

$(function () {
    $('#rightbox a').on('click', function () {
        var text = $('#myfilename');
        text.val($(this).text());    
        $Form.click();
    });
});


Any help would be very appeciated, I am completly new to javascript. I have found some info about regex and last indexof, but have no idea how to use them.

Sorry btw the links are like this:
CODE
<a href="/family_photos/filename1.jpg">filename1.jpg</a>
<a href="/family_photos/filename2.jpg">filename2.jpeg</a>


This post has been edited by Tiff 1998: May 7 2017, 12:44 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 11:55 PM