2

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.

1 Answer 1

3

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 :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.