user747796
user747796

Reputation: 43

jquery disabled button not working with IE

In my code I disable the submit button with jquery and then do a check to enable it. It works fine but not in IE. Could some please help me out, Thanks

function checkPassword() {
$('input#password').mouseout(function(){
    var password =$('#password').val();
    //event.preventDefault();
    //alert(password);
    $.ajax({
            type: "POST",
            url: "ajax/pass.php",
            cache: false,
            datatype:"html",
            data: "password="+ password,
            success: function(msg){
                if (msg) {
              $('#feedbk').html(msg);
              var name = $('#feedbk').text().length;
              var valid = 'Valid Password.';
              var n = valid.length

                    if (name == n) {
                        $('#submit').attr("disabled", false);
                        $('#feedbk').fadeOut(3000);

                    } else {
                       $('#submit').attr("disabled", true);

                    }
                }
             }
         });    
    });

};

Upvotes: 1

Views: 4061

Answers (2)

micahnyc
micahnyc

Reputation: 49

The solution is to use regular javascript

var el = document.getElementById(selectBoxCheckBoxOrButtonID);
el.removeAttribute('disabled');

Upvotes: 2

Sydwell
Sydwell

Reputation: 5024

I used straight JavaScript to sort out the problem

document.getElementById('selectBoxCheckBoxOrButtonID').removeAttribute('disabled');

Thanks @user843753 your solution work marvelously.

I am reiterating it here because I cannot comment at the moment and it looks so non- intuitive (What! not a jquery solution).

But why oh why is it not fixed in JQuery 1.6.2?

My original issues with IE include, re-enbled disable buttons, only be made visible on mouse-over. In another case the re-enabled disabled buttons could not made visible with any user interaction.

Upvotes: 0

Related Questions