Support » Plugins » getting the_content in a jquery img .on click

  • Shay


    I’ve been trying to get my content from posts to show up in a specific div but can’t get <?php the_content ?> to populate. When I replace it with text, it shows up. Any help?

    Current code:

    $(document).ready(function() {
    	  $("img").click(function () {
    		  if ($(this).hasClass("profiles")) {
    		    var img = $('<img />').attr({ 'src': $(this).attr('src'), 'alt': $(this).attr('alt') }).appendTo($('#student_area'));
    			var div = $('<div><?php get_the_content (); ?>This is the content</div>').attr({ 'alt': $(this).attr('alt') }).appendTo($('div.student_desc'));

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

  • The topic ‘getting the_content in a jquery img .on click’ is closed to new replies.