Grow your CSS skills. Land your dream job.

Simple Append Not Working (jQuery)

  • # February 17, 2011 at 11:50 am

    Hey guys,

    I’m just trying to use this code:

    In a WordPress site for the blog. Just want a simple way to get left and right quotes in each blockquote. This code was pasted in the footer. In the header, this is called:

    < ?php wp_enqueue_script("jquery"); ?>

    Anything I’m not doing right?

    - Steph

    # February 17, 2011 at 5:26 pm

    Hey, have you tested that the function is running by using a simple alert(‘this runs!!’); ? If it doesn’t run then try using $(document).ready(function(){ instead of $function(){. If it does run then maybe try putting in a manual link to your jquery file rather than using the enqueue method.

    Also, are you putting content into the spans dynamically? As there doesn’t appear to be any quotation marks within the spans in your code.

    # February 17, 2011 at 6:50 pm

    You have a typo.

    You notice how you end in }); ? Do you see the opening parenthesis?

    Change

    $function() {

    to

    $(function() {

    and you’ll be fine.

    # February 18, 2011 at 2:23 pm

    Thank you! That just about fixed it. Turns out I also had double quotes inside of double quotes, so it was conflicting.

    This is what I ended up with that did the job:

    $(function() {
    $('div.entry-text blockquote').prepend('"');
    $('div.entry-text blockquote').append('"');
    });
    # February 18, 2011 at 2:43 pm

    Oh yes, that is true, double double quotes are no good.
    Congrats

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".