The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Please help me jquery random click

+3
Draxion
SLGray
infotienminh
7 posters

Go down

Solved Please help me jquery random click

Post by infotienminh December 27th 2020, 9:20 pm

I have the following code
Code:
<a class="tab1"></a>
<a class="tab2"></a>
<a class="tab3"></a>

What can I do with this code when reloading the page ramdom click (tab1,tab2,tab3)

Code:
$('.ramdomtab1,2,3').click();


I need the code every time I reload the page and then random click the tab


Last edited by infotienminh on January 17th 2021, 8:07 am; edited 1 time in total
infotienminh
infotienminh
New Member

Posts : 5
Reputation : 2
Language : vietnamese

Back to top Go down

Solved Re: Please help me jquery random click

Post by SLGray December 27th 2020, 10:13 pm

The topic was posted in the wrong section, so I have moved it to the correct section.
Please read our forum rules:  ESF General Rules


Please help me jquery random click Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51498
Reputation : 3523
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

infotienminh likes this post

Back to top Go down

Solved Re: Please help me jquery random click

Post by Draxion December 28th 2020, 2:22 am

Sorry, I'm a little puzzled about what you are trying to accomplish. Can you elaborate a little more?
Draxion
Draxion
Helper
Helper

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

infotienminh likes this post

Back to top Go down

Solved Re: Please help me jquery random click

Post by infotienminh December 28th 2020, 6:44 pm

I need 1 jquery every time I reload the page, it will automatically click the class ( tab1,tab2,tab3 random)

Sorry, I use google translate so the translation is a bit wrong, do you understand what i mean
infotienminh
infotienminh
New Member

Posts : 5
Reputation : 2
Language : vietnamese

Back to top Go down

Solved Re: Please help me jquery random click

Post by Ape December 28th 2020, 7:03 pm

Where will this be placed ? I am asking as the code would have to be used on page to start off with. Would this just be on your home page or on all ages ?


Please help me jquery random click Left1212Please help me jquery random click Center11Please help me jquery random click Right112
Please help me jquery random click Ape_b110
Please help me jquery random click Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19324
Reputation : 2005
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

infotienminh likes this post

Back to top Go down

Solved Re: Please help me jquery random click

Post by infotienminh December 28th 2020, 7:13 pm

I am just showing on the homepage
infotienminh
infotienminh
New Member

Posts : 5
Reputation : 2
Language : vietnamese

Back to top Go down

Solved Re: Please help me jquery random click

Post by SarkZKalie December 29th 2020, 3:50 am

Could you please provide us your site URL here?


Please help me jquery random click Sarkzk10
SarkZKalie
SarkZKalie
Support Moderator
Support Moderator

Male Posts : 1442
Reputation : 220
Language : English

https://rotavn.forumotion.com/

Back to top Go down

Solved Re: Please help me jquery random click

Post by infotienminh January 11th 2021, 5:59 pm

SarkZKalie wrote:Could you please provide us your site URL here?
Code:
https://raovat24.forumvi.com/
my forum page
infotienminh
infotienminh
New Member

Posts : 5
Reputation : 2
Language : vietnamese

Back to top Go down

Solved Re: Please help me jquery random click

Post by Niko January 13th 2021, 1:00 pm

Dear @infotienminh

Give a try adding this javascript code and see if it works  thumleft

Code:
$(function() {
    var min = -1;
    var max = 3;
    // and the formula is:
    var random = Math.floor(Math.random() * (max - min + 1)) + min;
    $('.tab'+random).click();
});

Regards :rose:
Niko
Niko
Helper
Helper

Male Posts : 3231
Reputation : 248
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

skouliki, TheCrow and infotienminh like this post

Back to top Go down

Solved Re: Please help me jquery random click

Post by infotienminh January 16th 2021, 1:48 pm

Niko wrote:Dear @infotienminh

Give a try adding this javascript code and see if it works  thumleft

Code:
$(function() {
    var min = -1;
    var max = 3;
    // and the formula is:
    var random = Math.floor(Math.random() * (max - min + 1)) + min;
    $('.tab'+random).click();
});

Regards :rose:
so great thank you so much
infotienminh
infotienminh
New Member

Posts : 5
Reputation : 2
Language : vietnamese

Niko likes this post

Back to top Go down

Solved Re: Please help me jquery random click

Post by skouliki January 16th 2021, 2:12 pm

When your request is complete, please mark it as Solved.
skouliki
skouliki
Manager
Manager

Female Posts : 15311
Reputation : 1705
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

infotienminh likes this post

Back to top Go down

Solved Re: Please help me jquery random click

Post by skouliki January 17th 2021, 12:10 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules
skouliki
skouliki
Manager
Manager

Female Posts : 15311
Reputation : 1705
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum