sorry, I gave you the wrong syntax, should of been

$(document).ready(function() {
        $("div.image_single").click(function () {
                var url = $(this).find("a").attr('href');
                window.location = url;
        });
});



introvert wrote:
I get an error with the following code:

$(document).ready(function() {
$("div.image_single").click(function () {
var url = $(this).find("a").attr('href');
window.location(url);
});
});

[Exception... "Cannot convert WrappedNative to function" nsresult:
"0x8057000d (NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN)" location: "JS
frame :: http://www/index.php/gallery :: anonymous :: line 120" data:
no]
[Break on this error] window.location(url);

Any idea what am I doing wrong?

Thanks again!


On Feb 13, 4:38 pm, Liam Potter <radioactiv...@gmail.com> wrote:
$(document).ready(function() {
     $("div.somediv").click(function () {
        window.location(variableName);
     });

});
introvert wrote:
Hello
I'd like to put onclick event on simple div and preform action to go
to some variable's url.
$(document).ready(function() {
     $("div.somediv").click(function () {
//visit / go to some url
     });
});
How can I do that? Thanks a lot for help!

Reply via email to