I have the following code that I run whenever the .information
element is clicked. I am trying to add the aboutMe.html
document to the #text
element when the .information
is clicked:
$(".information").click( function() {
$.get("aboutMe.html"), function(data){
$("#text").html(data);
}});
For some reason the document is not added to the page when .information
is clicked.
I have the following code that I run whenever the .information
element is clicked. I am trying to add the aboutMe.html
document to the #text
element when the .information
is clicked:
$(".information").click( function() {
$.get("aboutMe.html"), function(data){
$("#text").html(data);
}});
For some reason the document is not added to the page when .information
is clicked.
-
2
You have an extra parenthesis in your example after the
"aboutMe.html"
– Jesan Fafon Commented May 23, 2014 at 20:08 - Check the console for errors? – j08691 Commented May 23, 2014 at 20:09
- Basic troubleshooting ... does your panel show any 404s? Have you added alerts to see if the listener is firing? Etc – WillardSolutions Commented May 23, 2014 at 20:09
- The console doesnt show any errors – SjoerdvdBelt Commented May 23, 2014 at 20:12
- 3 Interestingly, his mistake doesn't result in a syntax error. The ma turns from being an argument separator to the ma operator. – Barmar Commented May 23, 2014 at 20:12
2 Answers
Reset to default 5Your parentheses and braces are wrong. It should be:
$(".information").click( function() {
$.get("aboutMe.html", function(data){
$("#text").html(data);
});
});
Your callback function was outside the argument list of $.get()
.
Hope this will work for ýou
$(function() {
$('.information').click(function(){
$('#text').load("aboutMe.html");
});
});