Search code examples
javascriptjquerysummernote

how to add attribute name in summernote click to edit


I want to add element attribute name in summernote click to edit

html :

<button id="edit" class="btn btn-primary" onclick="edit()" type="button">Edit 1</button>
<button id="save" class="btn btn-primary" onclick="save()" type="button">Save 2</button>
<div class="click2edit">click2edit</div>

javascript:

var edit = function() {
  $('.click2edit').summernote({focus: true});
};

var save = function() {
  var makrup = $('.click2edit').summernote('code');
  $('.click2edit').summernote('destroy');
};

doc : http://summernote.org/examples/#click-to-edit


Solution

  • var edit = function() { 
      $('.click2edit').summernote({focus: true});
      $('.note-editor').find('textarea').attr('name','mytextarea');
    };