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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:26:07+00:00 2026-06-18T12:26:07+00:00

This question is related to another one I asked yesterday and its link is:

  • 0

This question is related to another one I asked yesterday and its link is:
Parse HTML in jquery through ajax into elements and replace each corresponding on page

Basically i want to call a php page with ajax and replace the elements in the response with the corresponding ones on the page. I got the following function in an answer:

 $(data ).filter('.maindiv').each(function (index) 
  /* "this" is the current div in response*/          
  $('#'+this.id).replaceWith(this);
 });

The above function woeks well when the div I want to replace has a regular id= but if use a custom attribute like gid= for example it won’t work. How can i fix this??

Thanks

  • 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-06-18T12:26:08+00:00Added an answer on June 18, 2026 at 12:26 pm

    You can select node with a gid attribute with:

    $('[gid]').replaceWith(this);
    

    you can even be more precise by selecting only the node which has the gid value you want

    $('[gid="hello"]').replaceWith(this);
    

    Hope it helps

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

Sidebar

Related Questions

This question is maybe related to the question i asked here: Jquery ajax request
This is a question related to another one I asked that was specific to
This question is related to another question which I asked yesterday! List all links
Another question related to this one . I have a List<SortableObjects> that is the
This question is related to another question I asked Basically, I have 2 horizontally
This is another question related to a question I asked a few minutes ago.
This question is related to another one I've posted recently: Check printing with Java/JSP
This question is related to another question I asked. In my other question I
UPDATE: Problem Solved. Darin Dimitrov's answer contains a link to another, related question. One
I've asked another related question to this here: casting dynamic to static problem I've

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.