Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [AJAX][JavaScript]Podmiana wartości data-counter-max w div
northwest
post
Post #1





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

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


Witam serdecznie,
Mam takiego div'a:
  1. <div class="productCounter addQuantity font-main hover-focus-color" data-counter-max="3" data-counter-step="1" data-counter-type="add" data-counter-field="#productQuantity">+</div>

W jaki sposób za pomocą jquery mogę podmienić parametr data-conter-max?
Wie ktoś może?


Northwest

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
markuz
post
Post #2





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

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


[JAVASCRIPT] pobierz, plaintext
  1. $('.productCounter.addQuantity.font-main.hover-focus-color').first().data('conter-max', 666);
[JAVASCRIPT] pobierz, plaintext


Ten post edytował markuz 1.02.2016, 22:16:32
Go to the top of the page
+Quote Post
northwest
post
Post #3





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

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


nie działa niestety (IMG:style_emoticons/default/sad.gif)
Go to the top of the page
+Quote Post
com
post
Post #4





Grupa: Zarejestrowani
Postów: 3 034
Pomógł: 366
Dołączył: 24.05.2012

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


zrób jsfiddla z tym (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
markuz
post
Post #5





Grupa: Zarejestrowani
Postów: 1 240
Pomógł: 278
Dołączył: 11.03.2008

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


Skoro data nie działa, to zrób attr (pewnie masz inna wersje jQuery, attr jest uniwersalne):
[JAVASCRIPT] pobierz, plaintext
  1. $('div').attr('data-counter-max', 10);
[JAVASCRIPT] pobierz, plaintext
Go to the top of the page
+Quote Post
com
post
Post #6





Grupa: Zarejestrowani
Postów: 3 034
Pomógł: 366
Dołączył: 24.05.2012

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


nie działało pewnie przez typo
Cytat(markuz @ 1.02.2016, 22:16:10 ) *
[JAVASCRIPT] pobierz, plaintext
  1. $('.productCounter.addQuantity.font-main.hover-focus-color').first().data('conter-max', 666);
[JAVASCRIPT] pobierz, plaintext


[JAVASCRIPT] pobierz, plaintext
  1. $('.productCounter.addQuantity.font-main.hover-focus-color').first().data('counter-max', 666);
[JAVASCRIPT] pobierz, plaintext


Ten post edytował com 2.02.2016, 00:22:29
Go to the top of the page
+Quote Post
northwest
post
Post #7





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

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


dziękuje, pomogło (IMG:style_emoticons/default/smile.gif)
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: 23.08.2025 - 18:31