Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

x-editable (twitter bootstrap): how to change the empty value?

I'm using the x-editable plug-in to have in-place edits and it works well.

The following jsfiddle shows an example from their documentation: http://jsfiddle.net/ibrahima_yock/CFNXM/27/

<div>
     <span>Status:</span>
     <a href="#" id="status"></a>
</div>

.

//make status editable
$('#status').editable({
    type: 'select',
    title: 'Select status',
    placement: 'right',
    source: [
        {value: 1, text: 'status 1'},
        {value: 2, text: 'status 2'},
        {value: 3, text: 'status 3'}
    ]
 });

As you can see in the jsFiddle, in the html pane the status is "empty" (written in red). We'd like to translate that word into another language. How can we specify it?

like image 884
I. YOCK Avatar asked Oct 21 '13 12:10

I. YOCK


2 Answers

You just add this option when setting up the field:

emptytext: 'Leer', // default is 'Empty'

Fiddle: http://jsfiddle.net/Saran/hdVYS/

You can find other options in the documentation.

like image 180
Saran Avatar answered Nov 01 '22 20:11

Saran


For those who prefer to use attributes, data-emptytext is another way to accomplish this:

<a href='#' id='status' 
    data-placeholder='This text appears when editing' 
    data-emptytext='This text appears when field is empty'> </a>
like image 42
Jonathan Lidbeck Avatar answered Nov 01 '22 20:11

Jonathan Lidbeck