Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Simple Append Not Working (jQuery)

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31669
    StephBertha
    Participant

    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:

    Anything I’m not doing right?

    – Steph

    #59675
    Johnnyb
    Member

    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.

    #59685
    noahgelman
    Participant

    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.

    #59463
    StephBertha
    Participant

    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('"');
    });
    #59466
    noahgelman
    Participant

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.