![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 158 Pomógł: 1 Dołączył: 6.12.2012 Ostrzeżenie: (0%) ![]() ![]() |
Jak zamienić we wszystkich div'ach z class="example" w attr id spacje na myślniki?
<div class="example" id="lorem ipsum"> <div class="example" id="dolor sit amet"> <div class="example" id="consectetur adipiscing elit"> wynik docelowy: <div class="example" id="lorem-ipsum"> <div class="example" id="dolor-sit-amet"> <div class="example" id="consectetur-adipiscing-elit"> Ten post edytował marcus755 17.09.2015, 09:01:03 |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 1 268 Pomógł: 254 Dołączył: 11.06.2009 Skąd: Świętochłowice Ostrzeżenie: (0%) ![]() ![]() |
Ale w sumie w JS wygląda to bardzo, bardzo podobnie (IMG:style_emoticons/default/wink.gif) Też trza pobrać elementy (document.querySelectorAll), zmieniasz atrybut (str.replace) i zapisujesz go na powrót.
BTW brakuje mi w PHP-owym DOM właśnie tego Selectors API, eh. |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 915 Pomógł: 210 Dołączył: 8.09.2009 Skąd: Tomaszów Lubelski/Wrocław Ostrzeżenie: (0%) ![]() ![]() |
... BTW brakuje mi w PHP-owym DOM właśnie tego Selectors API, eh. https://github.com/electrolinux/phpquery Ten post edytował redeemer 17.09.2015, 11:58:23 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 17.10.2025 - 18:01 |