JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://vitalets.github.com/x-editable/assets/mockjax/jquery.mockjax.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://vitalets.github.io/x-editable/assets/x-editable/bootstrap3-editable/css/bootstrap-editable.css">
<script src="http://vitalets.github.com/x-editable/assets/x-editable/bootstrap3-editable/js/bootstrap-editable.js"></script>
<p>X-editable Bootstrap 3 popup</p>
<table style="width:100%">
<tr>
<td>Jill</td>
<td id="status">Smith</td>
<td>50</td>
</tr>
</table>
JavaScript
// `/list` emulation
$.mockjax({
url: '/list',
responseTime: 400,
responseText: [{
value: 1,
text: 'status 1'
}, {
value: 2,
text: 'status 2'
}, {
value: 3,
text: 'status 3'
}]
});
// editable
$('#status').on('dblclick', function () {
$('#status').editable("destroy").editable({
type: 'select',
url: '/post',
pk: 1,
placement: 'left',
title: 'select status',
source: '/list'
});
});
$("#changeType").on("change", function () {
switch ($(this).prop("checked")) {
case true:
$("#status").editable("destroy");
$("#status").editable({
showbuttons: false,
onblur: 'ignore',
mode: 'inline',
send: 'never',
success: function (params) {
return false;
}
}).editable('show');
break;
case false:
$("#status").editable("destroy");
$("#status").editable().editable("show");
break;
};
});
// `/post` emulation
$.mockjax({
url: '/post',
responseTime: 400,
response: function (settings) {
if (settings.data.value === '3') {
this.status = 500;
this.responseText = 'Validation error!';
} else {
this.responseText = '';
}
}
});