2013-05-17 26 views

回答

0

試試這個:

$('.yourDivWrapper').on('focus', '.yourJEditElement input', function() { 
    var elem = $(this); 
    elem.attr('name', 'value'); 
}); 
0

你需要有一些黑客進入你的jeditable js文件。 然後,您可以用屬性添加自定義輸入,就像這樣:

$.editable.addInputType("customInput" , { 
     element : function(settings, original) { 
      var input = $('<input class="customClass"/>'); 
      if (settings.width != 'none') { 
       input.width(settings.width); 
      } 
      if (settings.height != 'none') { 
       input.height(settings.height); 
      } 

      input.attr('autocomplete', 'off'); 
      input.attr('customAttr', 'attr'); 
      $(this).append(input); 
      return (input); 
     } 
    }); 

此外,如果你想在提交時添加的屬性做這樣的事情:

$.editable.addInputType("dfsInputNumbers" , { 
     element : function(settings, original) { 
      var input = $('<input >'); 
      if (settings.width != 'none') { 
       input.width(settings.width); 
      } 
      if (settings.height != 'none') { 
       input.height(settings.height); 
      } 

      input.attr('autocomplete', 'off'); 
      $(this).append(input); 
      return (input); 
     }, 
    submit : function(settings, original) { 
     $('input', this).attr("customAttr", "attr") { 
    } 
    }); 

我沒有測試過還有一個,但我一直在黑客和添加一些輸入類型。查看教程:http://www.appelsiini.net/projects/jeditable/custom.html