This is a migrated thread and some comments may be shown as answers.

How to disable mobile button (suggestion)

3 Answers 252 Views
Button (Mobile)
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 14 Sep 2012, 09:40 AM
In my project I need some buttons to disable. Many posts here  and my support tickets telling that for the moment buttons cannot be disabled. I have a suggestion, because I think it is very simple.

If you make a button like <button>, it has attribute "disabled" and if this attribute is set click does not appear.
Second, for disabled buttons add some styling, and buttons are disabled:

.km-ios .km-button[disabled]{
    color:#ccc;
    cursor:default;
}
.km-ios .km-button[disabled]:active{
    color:#ccc;
    background-color:#7185A2;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
    -webkit-box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3);
    cursor:default;
}

<button type="button" data-role="button" disabled="disabled">My button</button>

3 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 28 Nov 2012, 09:55 PM

Try changing the pointer event.

pointer-events: none;
0
David T.
Top achievements
Rank 1
answered on 25 Jan 2013, 07:10 PM
Is there a way, if I have a button that starts out disabled, to enable it?  I tried this and it didn't work:

Note that when the page is loaded, my button initially says this:

disabled="disabled" OnClientClick="return false;"

            var cmd = $("cmdSubmit");
            var txt = $("#txtNote");

            // Enable the submit button if and only if we have data
            if ("" == txt.val())
            {
                cmd.attr("disabled", "disabled");
                cmd.attr("onclick", "return false;");
                alert("disabled");
            }
            else
            {
                cmd.attr("onclick", "");
                cmd.removeAttr("disabled");
                alert("enabled");
            }

Both alerts fire as you would expect, but the button is unchanged.
0
Lumir
Top achievements
Rank 1
answered on 21 Aug 2013, 09:16 AM
Apply k-disabled style, eg:

.k-disabled
{
pointer-events: none !important;
opacity:0.5 !important;
}
Tags
Button (Mobile)
Asked by
Alex
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
David T.
Top achievements
Rank 1
Lumir
Top achievements
Rank 1
Share this question
or