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 6540953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:02:38+00:00 2026-05-25T11:02:38+00:00

I want to overwrite the outerHTML of a few links with the same class

  • 0

I want to overwrite the outerHTML of a few links with the same class name. I just wanted to know if this is not working because jQuery doesn’t support .outerHTML. If it does, may you reference it? Also, is there a way to make this work:

$('.t').each(function() {
    $('.t').outerHTML = '<a href="http://www.google.com">' + 
        '<img src="' + $('.t').attr('src') + '" class="' + $('.t').attr('class') + '" /></a>';
});
  • 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-25T11:02:39+00:00Added an answer on May 25, 2026 at 11:02 am

    It looks like you’re just trying to wrap an <a> element around each .t. jQuery already has a method for doing this called .wrap

    You can read the documentation at https://api.jquery.com/wrap/

    An example of usage with your question would be:

    $('.t').wrap('<a href="http://google.com">');
    


    If you think you really need to set an element’s outerHTML, you might want to try using the snippet I wrote yesterday as an answer to another question. It mimics the behaviour of .html() but allows you to get or set the outerHTML() instead.

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

Sidebar

Related Questions

I want to cp a directory but I do not want to overwrite any
how to know the field variable name when output by views. eg:now, i want
Given two integers X and Y, I want to overwrite bits at position P
I'm deploying a Wordpress blog, but I don't want to overwrite the current site
I want to declare three properties in my MSBuild file and overwrite one property
I want to parse, process and then overwrite only 1 specific column in a
I want to override access to one variable in a class, but return all
For example I want to overwrite from UIButton: + (id)buttonWithType:(UIButtonType)buttonType So I would do:
I have a problem that I want to overwrite first 2^21 bytes of a
I'm using fstream to open a file for write. I don't want to overwrite

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.