jquery problem..need ur help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

jquery problem..need ur help

$(function(){ $("#x li:eq(1)").click(function(){ $("#y li:eq(0)").slideToggle(); $("#y li:eq(1)").slideToggle(); $("#y li:eq(2)").slideToggle(); )}; )}; how do i put the 3 function parameters in a single line of code? i tried this, $("#y li:eq(0)(1)(2)").slideToggle();...it ddn't work

12th May 2017, 7:10 PM
Kelvine De Danielo
Kelvine De Danielo - avatar
8 Answers
+ 5
I'm not using JQuery, and I don't know what's your html, but do you have simply try: $('#y li').slideToggle(); ?
12th May 2017, 8:59 PM
visph
visph - avatar
+ 5
Else, this would do the trick: $('#y li:nth-child(-n+3)').slideToggle(); edit : 3 not 5 :P
12th May 2017, 9:04 PM
visph
visph - avatar
+ 4
Provide the related html code... even the complete page code playground link for increase your chance to receive help ^^
12th May 2017, 8:31 PM
visph
visph - avatar
0
@Yaroslav...those codes above work just fine...all i want to know is to combine the function event to shorten the codes, if u ddn't know...
12th May 2017, 8:54 PM
Kelvine De Danielo
Kelvine De Danielo - avatar
0
I don't even know what is it, how can I help you with something undefined? is that something like accordion menu?
12th May 2017, 8:57 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
@Yaroslav....av u ever used jquery?....
12th May 2017, 9:03 PM
Kelvine De Danielo
Kelvine De Danielo - avatar
0
thanks visph...i'll try that....
12th May 2017, 9:04 PM
Kelvine De Danielo
Kelvine De Danielo - avatar
- 3
cancer of my eyes
12th May 2017, 8:34 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar