fro_oo
fro_oo

Reputation: 1610

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

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

Upvotes: 1

Views: 4492

Answers (3)

Nikolay Georgiev
Nikolay Georgiev

Reputation: 41

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

Upvotes: 4

Mohan Ram
Mohan Ram

Reputation: 8463

input[type='email'] 

This causes error for u check your codes again

Upvotes: 0

lonesomeday
lonesomeday

Reputation: 238005

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.

Upvotes: 0

Related Questions