Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]Zliczanie elementów
peja1990
post
Post #1





Grupa: Zarejestrowani
Postów: 150
Pomógł: 1
Dołączył: 4.12.2010

Ostrzeżenie: (10%)
X----


Witam,
czy może mi ktoś powiedzieć jak zliczyć wyniki "$(this).show();" ?


  1. $('.moduleAccess').hide();
  2. $('.moduleAccess').each(function(){
  3. if($(this).attr('dir') <= ui.value) {
  4. $(this).show();
  5. }
  6. });


Ten post edytował peja1990 14.12.2011, 13:57:21
Go to the top of the page
+Quote Post
wookieb
post
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




Co to znaczy zliczyć wyniki $(this).show() ?
Go to the top of the page
+Quote Post
jaslanin
post
Post #3





Grupa: Zarejestrowani
Postów: 511
Pomógł: 143
Dołączył: 13.03.2010
Skąd: Jasło

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


  1. $('.moduleAccess').hide();
  2. var i=0;
  3. $('.moduleAccess').each(function(){
  4. if($(this).attr('dir') <= ui.value) { ++i;
  5. $(this).show();
  6. }
  7. });
  8.  
  9. alert(i);


Ten post edytował jaslanin 14.12.2011, 14:08:42
Go to the top of the page
+Quote Post
peja1990
post
Post #4





Grupa: Zarejestrowani
Postów: 150
Pomógł: 1
Dołączył: 4.12.2010

Ostrzeżenie: (10%)
X----


Już sobie poradziłem (IMG:style_emoticons/default/smile.gif)

  1. var i = 0;
  2. $('.moduleAccess').hide();
  3. $('.moduleAccess').each(function(){
  4. if($(this).attr('dir') <= ui.value) {
  5. $(this).show();
  6. i += 1;
  7. }
  8. });
  9. if(i == 0) {
  10. $(".listBox .noResults").show();
  11. } else {
  12. $(".listBox .noResults").hide();
  13. }
  14. }
Go to the top of the page
+Quote Post

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: 6.10.2025 - 12:25