I want to add some class on div from href page with window.location.href('link');
and this javascript function is excecute after button is clicked
this is my full code
$(".crtresto").click(function(){
window.location.href = ('useron?on=profil&to=12345');
//This class is in the files useron
$('#crtresto').addClass('active');
});
so, the conclusion if i click the button with class (.crtresto) then the page will be directed to useron?on=profil&to=12345 , after directed to that page then automatically add class from the id(#crtresto)
thank you before
This won't work. After redirecting you cannot perform any action. So better option is you write the code to add class on useron page.
$(document).ready(function(){
$('#crtresto').addClass('active');
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.