Make Readonly?

Greg's Avatar


14 Jul, 2010 10:51 AM

Hello, how can I make the input readonly? I am prefilling the input with values and don't want the users to be able to modify it.


  1. 1 Posted by Greg on 14 Jul, 2010 11:03 AM

    Greg's Avatar

    Ahh, well that was easy:

    $("#nameSelector").attr("style", "display:none");
    $(".as-close").css("display", "none");

    nameSelector is the name of the input box specified in 'asHtmlID'
    as-close is the class used by the little 'x' displayed next to each entry.

  2. 2 Posted by itisrama on 21 Jul, 2010 04:34 AM

    itisrama's Avatar

    well, that will handle when user attempt to delete via button click, but user still able to delete via backspace key, the readonly issue is not solved yet then.

    do you have other solutions?


  3. 3 Posted by dejaanbu on 22 Feb, 2012 08:29 AM

    dejaanbu's Avatar

    I followed Greg's Suggestion.. with a little change
    $("#nameSelector").attr("disabled", "disabled"); $('#nameSelector').css({

             "background-color": '#FFFFFF',
    "border": '0'

    $(".as-close").css("display", "none");

    --no backspace pbm now..

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac