Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [jquery]zmiany klasy po id
trucksweb
post
Post #1





Grupa: Zarejestrowani
Postów: 1 199
Pomógł: 31
Dołączył: 22.03.2004
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


czy jest mozliwosc aby zmienic nazwe klasy elementowi po jego wartosci id ?

robie vcos takiego:
  1. var pole = $(this).attr('id');
  2. $(pole).removeClass("kolor");


gdzie pole przyjmuje nazwe id z elementu np. diva, ale juz nie dziala removeClass ? (IMG:http://forum.php.pl/style_emoticons/default/blinksmiley.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
lord_t
post
Post #2





Grupa: Zarejestrowani
Postów: 603
Pomógł: 131
Dołączył: 24.07.2007
Skąd: Górny Śląsk

Ostrzeżenie: (0%)
-----


Po podstawieniu pole do
Kod
$(pole).removeClass("kolor");

masz to wywołane tak:
Kod
$('xxx').removeClass("kolor");

a powinno być:
Kod
$('#xxx').removeClass("kolor");



P.S. Może lepiej zrobić tak:
Kod
$(this).removeClass("kolor");
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 17:27