Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Как получить доступ к элементу (https://javascript.ru/forum/jquery/26183-kak-poluchit-dostup-k-ehlementu.html)

vladimircape 29.02.2012 13:52

Как получить доступ к элементу
 
<div id="menuchoise">
<div id="1">
	<span><a href="#" class="Minus active">-</a></span>
	<span><a href="#" class="Plus not_active">+</a></span>
	<span><a href="#" class="Menu active">BRAUTKLEIDER</a></span>
	<div class="menuText">textBRAUTKLEIDER</div>
</div>
</div>

1.нужно чтобы по $(".Minus").click(function() через this можно было выбрать
class Plus и Menu
2.нужно чтобы по $(".Plus").click(function() через this можно было выбрать
class Minus и Menu
3.$(".Menu").click(function() выбрать класс menuText

zebra 29.02.2012 14:34

var minus = $(".Minus"), 
     plus = $(".Plus"),
     menu = $(".Menu"),
     menuText = $('.menuText');

minus.click(function() {
   // plus
});

plus.click(function() {
   // minus
});
//.....

T-sh 29.02.2012 17:01

1
$(this).parent().parent().find("span .plus");
$(this).parent().parent().find("span .menu");

2.
$(this).parent().parent().find("span .minus");
$(this).parent().parent().find("span .menu");

3.
$(this).parent().parent().find(".menuText");


Часовой пояс GMT +3, время: 05:29.