开发者

Can't disable an input[type='text'] or a textarea in jQuery Uniform?

开发者 https://www.devze.com 2023-01-31 18:27 出处:网络
I\'m trying to implement uniform in my project but I\'ve encountered an issue with disabled elements.

I'm trying to implement uniform in my project but I've encountered an issue with disabled elements.

I have selects, radiobuttons, checkboxes and other inputs (text, submit, reset, ...) in my page.

My javascript goes like this :

    $(function(){
      // NOT WORKING BECAUSE OF THE input[type='text'], input[type=开发者_运维知识库'email'] & textarea
      var el_list_bad = "select, input[type='checkbox'], input[type='radio'], input[type='file'], input[type='text'], input[type='email'], textarea";
      // WORKING BUT TEXT INPUTS AND TEXTAREAS ARE NOT DISABLED
      var el_list_incomplete = "select, input[type='checkbox'], input[type='radio'], input[type='file']";
      $(el_list_incomplete).uniform();
      $(el_list_incomplete).attr("disabled", true);
      $.uniform.update();
    });

When I use the "el_list_bad", I've this jQuery error and elements are not disabled : "TypeError: Result of expression 'g.nodeName' [undefined] is not an object."

Can you help me ? Thank you


jQuery('#_remember_me').attr('disabled', true);
jQuery.uniform.update();


Surely you could do this with two different selections...

$(function() {
    $("select, input[type='checkbox'], input[type='radio'], input[type='file']")
        .uniform()
        .add("input[type='text'], input[type='email'], textarea")
        .attr('disabled', true);
    $.uniform.update();
});

I'm not familiar with Uniform, but I don't see why this shouldn't work.


input[type='email'] 

This causes error for u check your codes again

0

精彩评论

暂无评论...
验证码 换一张
取 消