How do I achieve click on a link button on 1 page (say index.html), and when it navigates to the other (say dream.html), click a button on that page too, using Jquery?
Asked
Active
Viewed 40 times
2 Answers
1
Put a Jquery Script in page "dream.html" that clicks on your link when page load like:
$(document).ready(function(){
$('#link').click();
});

Mayank Pandeyz
- 25,704
- 4
- 40
- 59
1
Pass parameter in url and if exist that parameter trigger works for you.
your Url
http://dream.html?sent=yes
Check for param
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
If exist :
var param = getUrlParameter('sent');
if(param !== '')
$('#dreampageID').trigger("click");
Note : Do this inside document.ready and don't forget to include jquery librery.
getUrlParameter taken from here