- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Simple Append Not Working (jQuery)
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
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.
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.
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('"');
});
Oh yes, that is true, double double quotes are no good.
Congrats