Reputation: 24851
I use x-editable as inline editor http://vitalets.github.io/x-editable/docs.html
I want to toggle inline form by other link:
$("#how").click(function(e) {
e.stopPropagation()
e.preventDefault()
$("#com").editable({
'toggle',
validate: function(value) {
if($.trim(value) == '') {
return 'The content can not be blank!';
}
}
})
})
But it does not work, I want to know how to pass both toggle and validate option.
Upvotes: 2
Views: 1226
Reputation: 6469
Seperate the options declaration and the 'toggle' part will do the trick:
$("#how").click(function(e) {
e.stopPropagation();
e.preventDefault();
$("#com").editable({
validate: function(value) {
if($.trim(value) == '') {
return 'The content can not be blank!';
}
}
});
$("#com").editable('toggle');
});
Hope this is helpful for others :)
Upvotes: 3