even i changed the code become

function makeReadOnly(a) {
                     if ($("a:contains('disabled')")) {
                           $(a).attr("disabled",true);
                         }
                         else {
                      $(a).attr("disabled",false);
                         }
                   }

it don't go back to normal after i clear the check


On Apr 23, 7:09 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
> To change "disabled" or "readonly" you can use boolean values (true
> and false) and the "attr()" function.
>
> So if "a" is a jQuery selected text box (or a checkbox or any other
> form input), you can write:
>
> // Disable "a"
> a.attr('disabled', true);
>
> // Enable "a"
> a.attr('disabled', false);
>
> // Make "a" read-only
> a.attr('readonly', true);
>
> // Make "a" not read-only
> a.attr('readonly', false);
>
> Karl Rudd
>
> On Wed, Apr 23, 2008 at 12:19 AM, Andri <[EMAIL PROTECTED]> wrote:
>
> >  Hi, I'm newbie here
>
> >  there is two input form, checkbox and text. i want if I checked the
> >  chekbox, the input text will become readonly, and if i checked again,
> >  the input text back to normal. I'm trying make this function
>
> >   function makeReadOnly(a) {
> >                      if ($("a:contains('readonly')")) {
> >                            $("readonly = 'readonly'").replaceWith(" ");
> >                          }
> >                          else {
> >                      $(a).append("readonly = 'readonly'");
> >                          }
> >                    }
>
> >  but its not working. firebug says that replaceWith is not a function.
>
> >  anybody can help me out?

Reply via email to