问题描述:

I'm a jQuery newbie and I have managed to get a slideDown() animation to work on some text. However, when I add links (absolute or relative) to the text, it no longer appears on the page. What am I doing wrong? Thank you!!

<!DOCTYPE html>

<html>

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

<title>Text Slide Animation</title>

<script type="text/javascript">

$(document).ready(

function() {

$("#slideIn").hide();

$("#slideIn").html("<p> Coming off a long break after the 2014 &quot;Rebirth&quot; Album Salbakuta evolves yet again. 2016 sparked an all new birth of music and lyrics. Salbakuta (Charlie Mac, Mad Killah, and new member JawTee) brings a new flavor of music styles and beats. New producers like Mark Beats, Jawtee, and King Chase of New Dawn Music Group combine with Salbakuta&apos;s infectious lyrics have verified the return of this legendary Hip Hop group. </p> <p>Salbakuta has just released 3 new music videos on YouTube, (&quot;Biko&quot; Binibini Ko), (Wag iba ako nalang) and PinoyMyx (Wag kang Bitter). A small taste of the new album will be released soon on ITunes, Spotify, etc. It will be followed up with a full album under New Dawn Music Group, so standby for release dates. </p> <p>Salbakuta is now headlining shows and performing small concerts in preparation for the new album. You can catch them doing guest appearances on your local radio and TV stations. For more info on upcoming shows, events, and bookings <a href="#touch">get in touch</a> with us below.</p> <p>Salbakuta is a <b>New Dawn Music Group</b> artist</p>").slideDown('slow');

});

</script>

</head>

<body>

<div id="slideIn"></div>

<p id="touch">Get In Touch</p>

</body>

</html>

网友答案:

Since you're using double quotes for your HTML content in .html() method, use single quotes for <a href=:

 <a href='#touch'>
网友答案:

instead of using .html for adding content to #slideIn use .append and use .slideDown seperatly on #slideIn selector

相关阅读:
Top