Multiple Summer note divs on one page

user3367639

I am trying to get the code of a specific summer note div with multiple ones on a single page.

My summer notes are created from a database with php as follows:

<div class="tab-content">
  <?php $i=-1; foreach($contents as $content): ?>
      <?php $i++; ?>
      <div class="tab-pane" id="<?php echo $content->contentName; ?>">
          <div class="summernote" data-id="<?php echo $i; ?>">
              <?php echo $content->content; ?>
          </div>
      </div>
  <?php endforeach; ?>
</div>

And then my javascript is:

<script>
  $('.summernote').summernote({
    onblur: function(e) {
      var id = $('.summernote').data('id');
      var sHTML = $('.summernote').eq(id).code();
      alert(sHTML);
    }
  });
</script>

It always gets the first $('.summernote').eq(0).code(); summernote code never the second or third one.

What I'm trying to do is when each summernote gets a blur, have that code update in a hidden textarea to submit back to the database.

(btw) I am initilizing the summer notes like this:

<script>
  $(document).ready(function() {
    $('.summernote').summernote({
      height: 300,
    });
  });
</script>
mesutozer

After selecting all summernote's you need to access their attributes by specifying one element like:

<script>
  $('.summernote').each(function(i, obj) { $(obj).summernote({
    onblur: function(e) {
      var id = $(obj).data('id');
      var sHTML = $(obj).code();
      alert(sHTML);
    }
  });
});
</script>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

一页上有多个Summer note div

来自分类Dev

How do I print multiple images to one page on Chrome OS?

来自分类Dev

Change divs by clicking on one button

来自分类Dev

手动解密Chrome的Page Note Extension插件

来自分类Dev

Multiple Selects into one select

来自分类Dev

重写 Show/Hide Multiple Divs form JQ 来清除 JS

来自分类Dev

有什么方法可以将MS Access与MS One Note连接起来

来自分类Dev

在One Note 2016中为字典添加了拼写错误

来自分类Dev

Clojure, concat multiple sequences into one

来自分类Dev

Join multiple records to one row?

来自分类Dev

将SUMMER升级到SUMMER 5

来自分类Dev

使用One Note API在特定笔记本的特定部分中获取特定页面的最佳方法?

来自分类Dev

有没有办法将One Note笔记本电脑从其Skydrive位置取消关联?

来自分类Dev

使用One Note API在特定笔记本的特定部分中获取特定页面的最佳方法?

来自分类Dev

How do I position two divs vertically where the top one takes the remaining height?

来自分类Dev

Show multiple pages at once in their own page template

来自分类Dev

How to write multiple statements in one if block in clojure?

来自分类Dev

Left join multiple tables onto one table

来自分类Dev

How to undo strsplit to put multiple characters into one

来自分类Dev

Multiple synchronous streams in one Gulp task?

来自分类Dev

Check multiple checkboxes with one global funtion

来自分类Dev

Find matching type for one of multiple joined tables

来自分类Dev

sed to replace multiple words but skip one

来自分类Dev

Opposite of tidyr::separate, concatenating multiple columns into one

来自分类Dev

Jquery - Multiple function calls to one AJAX call

来自分类Dev

Find CSS path in one page checkout extension in magento?

来自分类Dev

divs溢出

来自分类Dev

toggleclass on multiple items within same jquery mobile page

来自分类Dev

Optimizing Page Load: multiple CDN files or single CDN file?

Related 相关文章

  1. 1

    一页上有多个Summer note div

  2. 2

    How do I print multiple images to one page on Chrome OS?

  3. 3

    Change divs by clicking on one button

  4. 4

    手动解密Chrome的Page Note Extension插件

  5. 5

    Multiple Selects into one select

  6. 6

    重写 Show/Hide Multiple Divs form JQ 来清除 JS

  7. 7

    有什么方法可以将MS Access与MS One Note连接起来

  8. 8

    在One Note 2016中为字典添加了拼写错误

  9. 9

    Clojure, concat multiple sequences into one

  10. 10

    Join multiple records to one row?

  11. 11

    将SUMMER升级到SUMMER 5

  12. 12

    使用One Note API在特定笔记本的特定部分中获取特定页面的最佳方法?

  13. 13

    有没有办法将One Note笔记本电脑从其Skydrive位置取消关联?

  14. 14

    使用One Note API在特定笔记本的特定部分中获取特定页面的最佳方法?

  15. 15

    How do I position two divs vertically where the top one takes the remaining height?

  16. 16

    Show multiple pages at once in their own page template

  17. 17

    How to write multiple statements in one if block in clojure?

  18. 18

    Left join multiple tables onto one table

  19. 19

    How to undo strsplit to put multiple characters into one

  20. 20

    Multiple synchronous streams in one Gulp task?

  21. 21

    Check multiple checkboxes with one global funtion

  22. 22

    Find matching type for one of multiple joined tables

  23. 23

    sed to replace multiple words but skip one

  24. 24

    Opposite of tidyr::separate, concatenating multiple columns into one

  25. 25

    Jquery - Multiple function calls to one AJAX call

  26. 26

    Find CSS path in one page checkout extension in magento?

  27. 27

    divs溢出

  28. 28

    toggleclass on multiple items within same jquery mobile page

  29. 29

    Optimizing Page Load: multiple CDN files or single CDN file?

热门标签

归档