Title: Getting  in jquery function
Last modified: August 20, 2016

---

# Getting in jquery function

 *  [Shay](https://wordpress.org/support/users/shaypessah/)
 * (@shaypessah)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/)
 * I currently have code in my header to show an image show in a specific div when
   clicked. What I would like to do, is have the content show in another div. I 
   managed to get the content to show (outside php), but was wondering if there 
   was a way to get the content from that post to show. The code is below and in
   script tags. Any advice?
 * ‘$(document).ready(function() {
    $(“img”).click(function () { if ($(this).hasClass(“
   profiles”)) { $(‘#student_area’).empty() var img = $(‘<img />’).attr({ ‘src’:
   $(this).attr(‘src’), ‘alt’: $(this).attr(‘alt’) }).appendTo($(‘#student_area’));
   $(“div.student_desc”).empty() var div = $(‘<div><?php get_the_content (); ?>This
   is the content</div>’).attr({ ‘alt’: $(this).attr(‘alt’) }).appendTo($(‘div.student_desc’));}});});’

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [billcolumbia](https://wordpress.org/support/users/billcolumbia/)
 * (@billcolumbia)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004765)
 * Try replacing ‘$’ with ‘jQuery’. I think wordpress reserves $ for something else.
 *  Thread Starter [Shay](https://wordpress.org/support/users/shaypessah/)
 * (@shaypessah)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004766)
 * Which ‘$’? The script works, just the <?php get_the_content (); ?> doesnt.
 *  [billcolumbia](https://wordpress.org/support/users/billcolumbia/)
 * (@billcolumbia)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004770)
 * I don’t think get_the_content returns the info. I think the_content does. If 
   you use get_the_content you need to store it in a variable or something.
 *  Thread Starter [Shay](https://wordpress.org/support/users/shaypessah/)
 * (@shaypessah)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004776)
 * It still didn’t work with the_content. I wonder if the way I have the code, its
   trying to print the content from the image itself and not the post.
 *  [billcolumbia](https://wordpress.org/support/users/billcolumbia/)
 * (@billcolumbia)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004778)
 * Is your code inside the loop?
 *  Thread Starter [Shay](https://wordpress.org/support/users/shaypessah/)
 * (@shaypessah)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004790)
 * Yes it is.
 *  [billcolumbia](https://wordpress.org/support/users/billcolumbia/)
 * (@billcolumbia)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004796)
 * Interesting. Sorry I couldn’t help.
 *  Thread Starter [Shay](https://wordpress.org/support/users/shaypessah/)
 * (@shaypessah)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004801)
 * It’s ok. It’s all a learning experience 🙂 Thank you for your help!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Getting in jquery function’ is closed to new replies.

## Tags

 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [the_content](https://wordpress.org/support/topic-tag/the_content/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [Shay](https://wordpress.org/support/users/shaypessah/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/getting-in-jquery-function/#post-3004801)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
