Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Jquery]Usuwanie elementów.
cykcykacz
post 3.06.2013, 13:28:51
Post #1





Grupa: Zarejestrowani
Postów: 550
Pomógł: 9
Dołączył: 29.05.2009
Skąd: Ostrów Wielkopolski

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


Witam, mam taki html:
  1. <label class="text" for="Nazwa_Firmy">Nazwa Firmy</label>
  2.  
  3. <div class="div_text">
  4. <input type="text" id="username" class="username" value="" name="log">
  5. </div>
  6. <div class="div_text">
  7. <input type="text" id="surname" class="surname" value="" name="log">
  8. </div>
  9. <div class="div_text">
  10. <input type="text" id="city" class="city" value="" name="log">
  11. </div>


I jak przy pomocy Jquery shować/usunąć div z klasą div_text i inputa z odpowiednim id?

Ja próbowalem w ten sposób:
[script]
$("fieldset .div_text #username").hide();
[/script]

Ale ten kod usuwa mi tylko inputa:
  1. <input type="text" id="city" class="city" value="" name="log">


A ja chcę aby usuwało mi z divem powyżej czyli usuneło:
  1. <div class="div_text">
  2. <input type="text" id="username" class="username" value="" name="log">
  3. </div>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
Damonsson
post 3.06.2013, 13:34:48
Post #2





Grupa: Zarejestrowani
Postów: 2 355
Pomógł: 533
Dołączył: 15.01.2010
Skąd: Bydgoszcz

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


[JAVASCRIPT] pobierz, plaintext
  1. $("#username").parent().hide();
[JAVASCRIPT] pobierz, plaintext


Ten post edytował Damonsson 3.06.2013, 13:35:01
Go to the top of the page
+Quote Post
slash^
post 3.06.2013, 13:34:53
Post #3





Grupa: Zarejestrowani
Postów: 278
Pomógł: 36
Dołączył: 9.04.2003
Skąd: Płock

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


[script]
$("#username").parent().hide();
[/script]

Ten post edytował slash^ 3.06.2013, 13:35:18


--------------------
d(^^)b
Go to the top of the page
+Quote Post
ber32
post 3.06.2013, 13:38:06
Post #4





Grupa: Zarejestrowani
Postów: 332
Pomógł: 22
Dołączył: 6.07.2010

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


Witam. może tak
  1. $(".div_text").hide();


--------------------
Go to the top of the page
+Quote Post
cykcykacz
post 3.06.2013, 13:49:17
Post #5





Grupa: Zarejestrowani
Postów: 550
Pomógł: 9
Dołączył: 29.05.2009
Skąd: Ostrów Wielkopolski

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


Jak bym zrobił tak usuneło by mi wszystkie .div_text.
A ja usuwam te które w sobie mają element z odpowiednim atrybutem id.

Posty wyżej wyjaśnij sprawę szybko!
Dzięki!
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 20.07.2025 - 20:41