Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6119375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:32:44+00:00 2026-05-23T15:32:44+00:00

I have an img html block <img src=folder1/folder2/folder3/logo1.png> positioned inside a big div like

  • 0

I have an img html block <img src="folder1/folder2/folder3/logo1.png"> positioned inside a big div like this

<div id="editorial">
   <div id="img_editorial"><img src="folder1/folder2/folder3/logo1.png" /></div>
</div>

When user hovers the <div id="editorial"> (mouseover) i want to read the attribute of <img> which is folder1/folder2/folder3/logo1.png extract the logo1.png from this and add on_ to the logo ( on_logo1.png ) and then output it with jquery .html() function to overwritte <div id="img_editorial">

On mouseout i want to return to logo1.png … because i have multiple background changes in that parent div … so the basic functionality is to grayout a logo when mouse is over a big div (also div`s background changes … etc) …

So .. how can i read the <img> attribute and then extract logo1.png and not the whole folder1/folder2/folder3/logo1.png …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:32:44+00:00Added an answer on May 23, 2026 at 3:32 pm

    You can read the attribute like this:

    var img_src = $('#img_editorial img').attr('src');
    

    This will give you:

    folder1/folder2/folder3/logo1.png
    

    Than you can split it with:

    var split_img_src = img_src.split('/');
    

    This will give you an array, something like:

    split_img_src[0] = folder1;
    split_img_src[1] = folder2;
    split_img_src[2] = folder3;
    split_img_src[3] = logo1.png;
    

    so the last value in the array should always be the name of the file – no matter how long the directory tree is.

    So you now have the file name, you can append what ever you want to it and do what ever you need.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link like: HTML: <a href=# title=> <img src=stack.png alt= title= />
I have a bit of html like so: <a href=#somthing id=a1><img src=something /></a> <a
I have the following HTML <div> <img id=image1 src=http://valleywag.com/assets/resources/2008/03/BlackGoogleLogo.jpg alt=Why doesn't this float correcly?
Let's say you have the following HTML: <html> <div style=text-align: center;> <img src=http://www.ps.uci.edu/~tomba/ants/sugar.jpg width=50
I have a page with this HTML: <p> <img src=images/ih01.jpg width=80 height=110 align=left />
I have an <img> in an HTML document that I would like to highlight
I have this HTML code: <span class=left> <img class=avatar src=image.jpg /> </span> <span class=right>
I have this html <div class=p-box> <div class=p-img></div> <h3>title</h3> <div class=txt>some txt</div> </div> with
I have the following block of HTML code more than once <div id=page_1 class=page>
I have the HTML given below: <ul id=thumbsPhotos> <li src=/images/1alvaston-hall-relaxing-lg.jpg onclick=updatePhoto (this.title)><img src=/images/1alvaston-hall-relaxing-sl.jpg width=56

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.