     labelHintEditor().container.show()
     labelHintEditor().container.offset(labelHintOffset)
     labelHintEditor().container.width(Builder.resourceEditorCurrentLabelHint.outerWidth())
-    labelHintEditor().textfield.val(labelHintValue()).focus()
+    labelHintEditor().editControl.val(labelHintValue()).focus()
     labelHintEditor().checkbox.prop('checked', isLabelHintHtml())
     # Set tooltip for checkbox and HTML5 placeholders (don't do this once for all, as the language can change)
     labelHintEditor().checkbox.tooltip(title: $('.fb-message-lhha-checkbox').text())
-    labelHintEditor().textfield.attr('placeholder', $(".fb-message-type-#{lhha()}").text())
+    labelHintEditor().editControl.attr('placeholder', $(".fb-message-type-#{lhha()}").text())
     # Hide setting visibility instead of .hide(), as we still want the label to take space, on which we show the input
     Builder.resourceEditorCurrentLabelHint.css('visibility', 'hidden')
     # Add class telling if this is a label or hint editor

    # If editor is hidden, editing has already been ended (endEdit can be called more than once)
    if labelHintEditor().container.is(':visible')
        # Send value to server, handled in FB's model.xml
        newValue = labelHintEditor().textfield.val()
        isChecked = labelHintEditor().checkbox.is(':checked')
        OD.dispatchEvent
            targetId: Builder.resourceEditorCurrentControl.attr('id')

labelHintEditor = _.memoize ->
    # Create elements and add to the DOM
    editor = {}
    textfield = $('<input style="display: none" type="text">')
    textarea  = $('<textarea style="display: none"></textarea>')
    # End edit when users press enter in the textfield (but not the text area)
    textfield.on('keypress', (e) -> if e.which == 13 then Builder.resourceEditorEndEdit())
    editor.editControl = null
    editor.selectTextInput = ->
        editor.editControl?.hide()
        editor.editControl = if lhha() == 'text' then textarea else textfield
        editor.editControl.show()
    editor.checkbox   = $('<input type="checkbox">')
    editor.container  = $('<div class="fb-label-editor">').append(textarea).append(textfield).append(editor.checkbox)
    editor.container.hide()
    $('.fb-main').append(editor.container)
    # Register event listeners
    editor.checkbox.on('click', -> labelHintEditor().editControl.focus())
    editor

# Show editor on click on label
