 
     make_readonly: () ->
       if @editable
-        @nod.get(0).setAttribute('readonly', 'readonly')
+        @input.get(0).setAttribute('readonly', 'readonly')
         @nod.addClass 'is-readonly'
         @editable = false
         @changed 'editable'


  class pi.TextInput extends pi.Base
    initialize: ->
      @editable = true
      make_readonly if @options.readonly
      super

    make_editable: () ->
      if not @editable
        @nod.get(0).removeAttribute('readonly') 
        @nod.removeClass 'is-readonly'
        @editable = true
        @changed 'editable'


    value: (val = null) ->
      if val?
        @input.val(val)
      @input.val()

    clear: () ->
      @input.val ''