jQuery - missing } after function body [closed]
Where is problem: I got error: missing } after function body
(function($) {
$(document).ready( function() {
$("div.area_map").click( function () {
alert('clicked');
$('img.hoverswap', this).css({
position:"absolute",
left:"0px",
top:"0px",
width: "120",
height: "52",
zIndex: "9999"}).attr("src","default/citymap/D5.png");
$.get("save.php", {id: 1, action: all}, function(result) {
$("#results").html(result);
});
});
}) ( jQuery );
is it just me or you have forgotten to close the ready handler function?
(function($) {
$(document).ready( function() {
$("div.area_map").click( function () {
alert('clicked');
$('img.hoverswap', this).css({
position:"absolute",
left:"0px",
top:"0px",
width: "120",
height: "52",
zIndex: "9999"}).attr("src","default/citymap/D5.png");
$.get("save.php", {id: 1, action: all}, function(result) {
$("#results").html(result);
});
});
}); // <<--- missing here.
}) ( jQuery );
You forgot to close the
$("div.area_map").click( function () {
so add another });
try this:
$(document).ready( function() {
$("div.area_map").click( function () {
alert('clicked');
$('img.hoverswap', this).css({
position:"absolute",
left:"0px",
top:"0px",
width: "120",
height: "52",
zIndex: "9999"}).attr("src","default/citymap/D5.png");
$.get("save.php", {id: 1, action: all}, function(result) {
$("#results").html(result);
});
});
});
Try this :)
$(document).ready(function() {
$("div.area_map").click( function () {
alert('clicked');
$('img.hoverswap', this).css({
position : "absolute",
left : "0px",
top : "0px",
width : "120",
height : "52",
zIndex : "9999"
}).attr("src","default/citymap/D5.png");
$.get("save.php", {id: 1, action: all}, function(result) {
$("#results").html(result);
});
});
});
精彩评论