Josh J Josh J - 1 year ago 143
jQuery Question

Get ID of Summernote Element

I am going to have multiple summernote fields on a page, and I want a dynamic way to get the element ID when doing onblur. I can't seem to get the elements id, it just comes back undefined

Example HTML

<div class="summernote" id="desc_long" name="Long Description">Test 123</div>


$(function () {
toolbar: [
['headline', ['style']],
['style', ['bold', 'italic', 'underline', 'clear']],
['color', ['color']],
['font', ['strikethrough', 'superscript', 'subscript']],
['alignment', ['ul', 'ol', 'paragraph']],
['insert', ['link']],
onblur: function() {
var objid = $(this).attr("id");

Answer Source

Which version of summernote are you using?? If it's v0.6.5 or greater then use camel case i.e. onBlur and not onblur . Try this and check. Also post what error are you getting,if any. Also, callback function is missing. Check

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download