Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jquery + ajax + zmiana href w odnośnikach
morawcik89
post
Post #1





Grupa: Zarejestrowani
Postów: 56
Pomógł: 1
Dołączył: 15.07.2008

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


Mam taki problem.
Wczytuję za pomocą ajaxa w jquery część pliku która wygląda tak:
Kod
<p class="el"><a href="plany/o1.html" target="plan">1a 1TI</a></p>
<p class="el"><a href="plany/o2.html" target="plan">1b 1TI</a></p>
<p class="el"><a href="plany/o3.html" target="plan">1c 1TI</a></p>
<p class="el"><a href="plany/o4.html" target="plan">1d 1TEE/H</a></p>
<p class="el"><a href="plany/o5.html" target="plan">1e 1TEK</a></p>
<p class="el"><a href="plany/o6.html" target="plan">2a 2TI</a></p>
<p class="el"><a href="plany/o7.html" target="plan">2b 2TI</a></p>
<p class="el"><a href="plany/o8.html" target="plan">2c 2TI / E</a></p>
<p class="el"><a href="plany/o9.html" target="plan">2e 2TE / H</a></p>
<p class="el"><a href="plany/o10.html" target="plan">3a 3TI</a></p>
<p class="el"><a href="plany/o11.html" target="plan">3b 3TI</a></p>
<p class="el"><a href="plany/o12.html" target="plan">3d 3TEE</a></p>
<p class="el"><a href="plany/o13.html" target="plan">3e 3TEK</a></p>
<p class="el"><a href="plany/o14.html" target="plan">4a 4TI</a></p>
<p class="el"><a href="plany/o15.html" target="plan">4b 4TI</a></p>
<p class="el"><a href="plany/o16.html" target="plan">4d 4TEE</a></p>
<p class="el"><a href="plany/o17.html" target="plan">4e 4TEK</a></p>
<p class="el"><a href="plany/o18.html" target="plan">4h 4TH</a></p>


Te dane umieszczam w #help1 .
Teraz wybieram same linki ($("#help1").children().children() ), umieszczam w #plan_cont i jest ok.
Teraz nie potrafię zmienić atrybutu href na java script:plan(stary href).
Próbowałem na różne sposoby ale ciągle dodaje mi pierwszy href.
Proszę o szybką pomoc.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
bregovic
post
Post #2





Grupa: Zarejestrowani
Postów: 562
Pomógł: 15
Dołączył: 8.08.2003
Skąd: Denmark/Odense

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


Stary, po co chcesz zmieniać href? Nie lepiej dodać onclick? Np tak:
  1. $('a').each(function() {
  2. $(this).click(function() {plan($(this).href); return false;});
  3. });

Pisane z palca, pewnie są błędy.

Edit: Nie do końca rozumiem twój problem, możesz pokazać więcej kodu?

Ten post edytował bregovic 6.11.2008, 19:06:27


--------------------
Prank - for the fun. Mac - for the simplicity. Deviantart - for the kick.
Life is ours, We live it our way -- Metallica
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 Aktualny czas: 21.08.2025 - 14:42