Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Atrybut "require" w Safari
northwest
post
Post #1





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

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


Witam serdecznie,
Często stosuje w formularzach "required". Praktycznie wszystkie nowe przeglądarki obsługują go bez problemu (jedynie Safarii go nie wspiera).

Znacie może jakiś prosty sposób (lub skrypt) który sprawdzałby wypełnienie pól w Safarii - analogicznie do required?

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





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

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


http://stackoverflow.com/questions/2326130...-safari-browser
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----


Dziękuję smile.gif

Podali tutaj taki kod:

  1. [/php]
  2.  
  3. Da się go w jakiś sposób połączyć z :
  4.  
  5.  
  6. [php]$('form').submit(function() {
  7. var email1 = $('input[name="email1"]').val();
  8. var email2 = $('input[name="email2"]').val();
  9. if(email1 != email2) {
  10. alert('Podane adresy email są różne!');
  11. return false;
  12. }
  13. });


questionmark.gifsmile.gif
Go to the top of the page
+Quote Post
trueblue
post
Post #4





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

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


http://jsfiddle.net/65gog700/1/


--------------------
Go to the top of the page
+Quote Post
northwest
post
Post #5





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

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


Zmieniłem ten kod na:
  1. $('form').submit(function() {
  2. var email1 = $('input[name="email1"]').val();
  3. var email2 = $('input[name="email2"]').val();
  4. if(!email1 || !email2){
  5. alert('Podaj email!');
  6. return false;
  7. }
  8. else if(email1 != email2) {
  9. alert("Podane emaile różnią się od siebie!");
  10. return false;
  11. }
  12. });


Dziękuję.

Chciałem go jednak połączyć z tym sprawdzaniem require w Safarii smile.gif

Mógłbyś mi to "złączyć" w jedną funkcję?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 21:52