SORU
15 Ocak 2011, CUMARTESİ


Devre dışı öznitelik geçiş giriş jQuery kullanarak

İşte benim kod:

$("#product1 :checkbox").click(function(){
    $(this)
        .closest('tr') // Find the parent row.
            .find(":input[type='text']") // Find text elements in that row.
                .attr('disabled',false).toggleClass('disabled') // Enable them.
                .end() // Go back to the row.
            .siblings() // Get its siblings
                .find(":input[type='text']") // Find text elements in those rows.
                .attr('disabled',true).removeClass('disabled'); // Disable them.
});

Nasıl .attr('disabled',false); geçiş yapabilirim?

Google üzerinde bulmak için görünmüyor olabilir.

CEVAP
15 Ocak 2011, CUMARTESİ


Bensanırımtam tarayıcı uyumluluk disabled 6 ** değerini ayarlamak veya görevden almak gerekir!
Burada sadece yaptığım küçük bir eklenti:

(function($) {
    $.fn.toggleDisabled = function() {
        return this.each(function() {
            var $this = $(this);
            if ($this.attr('disabled')) $this.removeAttr('disabled');
            else $this.attr('disabled', 'disabled');
        });
    };
})(jQuery);

Example link.

EDİT: güncellenen örnek chainability korumak için/kod link!
EDİT 2:
@Yorum lonesomeday göre, burada geliştirilmiş bir versiyonu:

(function($) {
    $.fn.toggleDisabled = function(){
        return this.each(function(){
            this.disabled = !this.disabled;
        });
    };
})(jQuery);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Christian Atlas

    Christian At

    26 Mart 2009
  • maxman.tv

    maxman.tv

    29 EKİM 2013
  • PoreoticsHD

    PoreoticsHD

    22 NİSAN 2010