What is wrong here? I want replace ul content with other content
$('#carouselselectitem1').click(function() {
$('#foo2').html('<li><div id="lines"></div><div id="tittle">2 PROGRAMEO, LONDRES</div><div id="image"></div><div id="text">LOREM IPSUM XHTML+CSS3 HTTP://WWW.url.com/</div></li>');
});
-
1possible duplicate of error code with html jQueryRoko C. Buljan– Roko C. Buljan2013年01月14日 03:04:34 +00:00Commented Jan 14, 2013 at 3:04
-
So... why did you ask the same question twice within one hour?sachleen– sachleen2013年01月14日 03:07:51 +00:00Commented Jan 14, 2013 at 3:07
3 Answers 3
Your fiddle includes mootools instead of jQuery.
You have a line break in a string in your fiddle. Either remove it or add a \ at the end of the first line of the string like below: (notice the \ at the end of the 2nd line of code below)
$('#carouselselectitem1').click(function() {
$('#foo2').html('<li><div id="lines"></div>\
<div id="tittle">TITTLE2</div><div id="image"></div><div id="text">TEXT2</div></li>');
});
answered Jan 14, 2013 at 3:01
sachleen
31.2k8 gold badges82 silver badges75 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
Vektor Unbreakable
thanks!!!! Work fine. and yes, sachleen, i'm new here and i must wait a lot of time for write. Sorry.
Try this,
$('#carouselselectitem1').click(function() {
$('#foo2').html('<li><div id="lines"></div><div id="tittle">TITTLE2</div><div id="image"></div><div id="text">TEXT2</div></li>');
});
answered Jan 14, 2013 at 3:05
Nandu
3,1268 gold badges37 silver badges51 bronze badges
1 Comment
sachleen
When answering please make sure to explain what you changed in the code.
There are a number of problems with your fiddle.
- jQuery is not loaded
- Your Javascript has a line break in a string
- The click event needs to be attached after the document is loaded
This fiddle works
$(document).ready( function(){
$('#carouselselectitem1').click(function() {
$('#foo2').html('<li><div id="lines"></div><div id="tittle">TITTLE2</div><div id="image"></div><div id="text">TEXT2</div></li>');
});
});
answered Jan 14, 2013 at 3:05
PassKit
12.6k5 gold badges61 silver badges78 bronze badges
lang-js