Reputation: 1
Am trying to combine two JQuery functions, but without any success.
if (querySt("photoid")) {
var value = querySt("photoid");
alert(value);
}
with
window.onload = function() {
if(window.location.hash) {
$(window.location.hash).trigger('click');
}
};
Have tried the following:
if (querySt("photoid")) {
var value = querySt("photoid");
window.onload = function() {
if(window.location.value) {
$('#' + window.location.value).trigger('click');
}
}
};
Hash requires to be replaced with the actual '#' symbol. photoid returns the image id value like 415.
Any suggestion will be much appreciated.
Kind regards, Charl
Upvotes: 0
Views: 72
Reputation: 9869
You should try this
window.onload = function() {
if (querySt("photoid")) {
var value = querySt("photoid");
alert(value);
}
if(window.location.hash) {
$(window.location.hash).trigger('click');
}
};
Upvotes: 1