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

  • Home
  • SEARCH
  • 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 6962867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:42:55+00:00 2026-05-27T15:42:55+00:00

I know its sounds a bit crazy, but im doing some pretty complex (complex

  • 0

I know its sounds a bit crazy, but im doing some pretty complex (complex for me, not for better JS coder) WordPress theme and text in articles expands on hover,and post images shows in different div, and other stuffs. Anyhow I need a function that will check every post (article) and if post have img in it to put that img in other div, if not, live it as it is. I was never good at if else statements, I tried something but it didn’t helped.

var picture = $('.post p').find('img');    
$(this).find('.postimage').empty().append(picture);

This worked as a test, but of course it appends image from first post to all “postimage” divs, and its not a wanted solution.

  • 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-27T15:42:56+00:00Added an answer on May 27, 2026 at 3:42 pm

    Use the .each() method to operate on each matched item individually.

    e.g.

    var picture = $('.post p img').each(function(index, element) {
        // the following line will need to change depending on how you need to find the correct .postimage div from the .post div
        $(this).closest('.post').find('.postimage').empty().append(element); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know, I know, its sounds silly, but it seems that there are no
The question sounds weird I know. But its a weird question. Let me clarify.
I know this sounds extremely newbieish, but even after going through some of the
I know this sounds like a really obvious question, but it's proving harder to
I know its impossible for 100% protection, but something high or that works for
I know its possible to receive a dayClick event on Fullcalendar. But I would
I know the title sound confusing and thats because it is. its a bit
Hey all. I know this sounds simple, but I can't find a way to
My question sounds a bit trivial; however, I was not able to find anything
Does anyone know why Microsoft does not ship a numeric text box with its

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.