Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
2201 Lượt xem

hello 

i am beginner in odoo 

i have three div have same class i want use this to call fun to one div only

thanks

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You can use ":eq(index)"

https://api.jquery.com/eq-selector/

https://api.jquery.com/nth-child-selector/



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi, alice

You can try below code:

    $(this).on('click', ".classname", function () {});

Make sure it will helpful.

Thank you.

Ảnh đại diện
Huỷ bỏ

"i want to use this call fun to one div only" - yours does all.

$(this).on('click', ".classname:eq(<div index>)", function () {});