 
   class pi.TextInput extends pi.Base
     initialize: ->
+      @input = if @nod.get(0).nodeName.toLowerCase() is 'input' then @nod else @nod.find('input')
       @editable = true
       make_readonly if @options.readonly
       super
 
     make_editable: () ->
       if not @editable
-        @nod.get(0).removeAttribute('readonly') 
+        @input.get(0).removeAttribute('readonly') 
         @nod.removeClass 'is-readonly'
         @editable = true
         @changed 'editable'


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


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

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