Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [jQuery]Czy podany fragment kodu można skrócić?
S_Olewniczak
post
Post #1





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

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


Piszę skrypt w oparciu o jQuery i mam pytanie: Czy podany kod można uprościć:
Kod
    td =  $(document.createElement('td')).appendTo(tr);
   select = $(document.createElement('select')).appendTo(td);
   optgr_opt = $(document.createElement('optgroup')).appendTo(select);

Bo mam wrażenie jakbym nie postępował w myśl zasady DRY.
Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
S_Olewniczak
post
Post #2





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

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


A tan kod:
Kod
$(table + ' th').each(function(index) {
    $(table + ' tr').each(function() {
        $(table + ' tr td::eq(' + index + ')')
    });

Czy można go też uprościć?

Ten post edytował S_Olewniczak 3.07.2009, 19:10:01
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: 26.12.2025 - 10:20