WordPress.org

Support

Support » How-To and Troubleshooting » Getting in jquery function

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)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Getting in jquery function’ is closed to new replies.