Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript]Checbox all disabled input text
Forum PHP.pl > Forum > Przedszkole
arzach

Witam mam taki o to kod
[JAVASCRIPT] pobierz, plaintext
  1. <html>
  2. <head>
  3.  
  4. <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  5. <head>
  6. <body>
  7. <script>
  8. $(document).ready(function(){
  9.  
  10. $('.forecast').on('change', ':checkbox', function () {
  11.  
  12. $(this).closest('tr').find('input:text').attr("disabled", !this.checked);
  13.  
  14. }).find(':checkbox').change();
  15.  
  16. $("#selecctall").change(function(){
  17. $(".forecast :checkbox").prop('checked', $(this).prop("checked"));
  18.  
  19. if($('.forecast :checkbox').is(':checked')) {
  20.  
  21. $(".forecast :text").prop('disabled', $(this).prop("disabled"));
  22.  
  23. } else {
  24. $(".forecast :text").prop('disabled', $(this).prop("disabled", true));
  25.  
  26. alert('test');
  27. }
  28.  
  29.  
  30. });
  31. });
  32.  
  33.  
  34.  
  35. </script>
  36.  
  37.  
  38. <input type="checkbox" id="selecctall"/>Selecct All
  39. <table class="forecast">
  40. <tr><td><input type="checkbox" /></td><td><input type="text" value="0" disabled="disabled" /></td></tr>
  41. <tr><td><input type="checkbox" /></td><td><input type="text" value="0" disabled="disabled" /></td></tr>
  42. <tr><td><input type="checkbox" /></td><td><input type="text" value="0" disabled="disabled" /></td></tr>
  43. <tr><td><input type="checkbox" /></td><td><input type="text" value="0" disabled="disabled" /></td></tr>
  44. <tr><td><input type="checkbox" /></td><td><input type="text" value="0" disabled="disabled" /></td></tr>
  45. </table>
  46. </body>
  47. </html>
[JAVASCRIPT] pobierz, plaintext

I wszystko było by dobrze gdyby nie to ze po zaznaczeniu checkbox all i odznaczeniu blokuje mi ten checkbox

Zobaczyć można na
https://jsfiddle.net/vdkopec/m6L8nq94/2/

Proszę o pomoc
Arcioch
https://jsfiddle.net/m6L8nq94/4/
Tym go blokujesz:
  1. $(this).prop("disabled", true)


Tam nie pobierasz argumentu tylko go ustawiasz smile.gif

arzach
Dziękuje bardzo.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.