私はjeditableを使用しており、すべてjeditableにバインドされたネストされた要素を持っています。問題は、クリックイベントが最上位の親でトリガーされる入れ子要素をクリックすることです。どうすればこれを避けることができますか?ここでjeditable伝播
$(document).ready(function() {
console.log('loading');
$('div.wrapper').editable('edit/', {
loadurl : 'edit/',
//id : 'section',
name : 'content',
submitdata : function(value, settings) {
var section = $(this).parent('section').attr("data-section");
return {
section: section,
type: 'ajax',
}
},
loaddata : function(value, settings) {
var section = $(this).parent('section').attr("data-section");
return {
section: section,
type: 'ajax',
}
},
rows : 6,
width : '100%',
type : 'textarea',
cancel : 'Cancel',
submit : 'OK',
indicator : 'Saving changes',
tooltip : "Doubleclick to edit...",
onblur : 'ignore',
event : "dblclick",
style : 'inherit',
callback : function(value, settings) {
// console.log(this);
console.log(value);
console.log(settings);
$('section[class^="annotation"]').each(function(index) {
$(this).attr('data-section', index + 1);
});
}
});
});
[編集]
は、HTMLコードは次のとおりです。
<article>
<section class="annotation1" data-section="1" id="section_data-section1" typeof="aa:section">
<div class="wrapper" title="Doubleclick to edit...">
<h1>Section </h1>
<p>some content</p>
<section class="annotation2" data-section="2" id="subsection_data-section2" typeof="aa:section">
<div class="wrapper" title="Doubleclick to edit...">
<h2>Subsection </h2>
<p>some more content</p>
</div>
</section>
</div>
</section>
</article>
ありがとう!
あなたのHTMLコードを提供できますか? –
あなたはあなたのHTMLコードも提供できますか? –
私の投稿を編集しました – Alex