Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Automatyczne klikanie w button
Maciek316
post
Post #1





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 31.03.2012

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


Witam, proboje automatycznie kliknac w button za pomoca js, ale cos mi nie dziala.
Mysle ze to przez wlasne atrybuty w buttonie.
  1. <button id="test" class="btn btn-default" type="button" data-layer-target="#modal-2">Modal-like</button>
  2. <script>
  3. document.getElementById("test").click();
  4. </script>

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Maciek316
post
Post #2





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 31.03.2012

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


Tylko tyle mam kodu:

  1. <button id="test" class="btn btn-default" type="button" data-layer-target="#modal-2">Modal-like</button>
  2. <script>
  3. var test = document.getElementById("test");
  4. test.addEventListener('click', function(e){
  5. console.log(e);
  6. alert('ok');
  7. });
  8. document.getElementById("test").click();
  9. </script>
  10.  
  11. <div id="modal-2" class="modal-2 tiny-layer-hide" data-close-on-overlay-click="false" data-close-on-esc-key="false" data-close-btn-markup="false">
  12. <div class="woman"></div>
  13. <div class="woman2">
  14. <h3>Awansowałeś!</h3>
  15. </div>
  16. </div>

Reszta to biblioteka js tiny-layer.
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: 13.10.2025 - 10:50