我将在一个页面上有多个summernote字段,并且我想要一个动态的方式来获取元素ID在做onblur时。我似乎无法得到的元素ID,它只是回来不确定获取Summernote元素的ID
例HTML
<div class="summernote" id="desc_long" name="Long Description">Test 123</div>
的Javascript
$(function() {
$('.summernote').summernote({
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");
alert(objid);
}
});
});
我认为这里是全局对象 – Geeky
通过event.target访问id – Geeky
试着在控制台上打印这个,看看哪个对象变得模糊。的console.log($(本)); –