Javascript 在jQuery中从DIV获取文本
我有以下类型的DIV:Javascript 在jQuery中从DIV获取文本,javascript,jquery,css,Javascript,Jquery,Css,我有以下类型的DIV: <div class='entry'> <p class='entry-text'>собаки играют вместе <a title="Search private" class="app-context-link" href="/contexts/private">@private</a></p> <p class='entry-
<div class='entry'>
<p class='entry-text'>собаки играют вместе <a title="Search private" class="app-context-link" href="/contexts/private">@private</a></p>
<p class='entry-date'>14172869383540000</p>
<p class='entry-menu'> <a class="app-link-menu" href="#">show filtered</a></p>
<div class='separator'> </div>
</div>
谢谢 这应该可以做到:
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', e.currentTarget).text());
}
$('.entry text',e.currentTarget)
选择e.currentTarget
元素中具有entry text
类的所有元素,然后对其调用.text()
资料来源:
这应该可以做到:
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', e.currentTarget).text());
}
$('.entry text',e.currentTarget)
选择e.currentTarget
元素中具有entry text
类的所有元素,然后对其调用.text()
资料来源:
这应该可以做到:
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', e.currentTarget).text());
}
$('.entry text',e.currentTarget)
选择e.currentTarget
元素中具有entry text
类的所有元素,然后对其调用.text()
资料来源:
这应该可以做到:
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', e.currentTarget).text());
}
$('.entry text',e.currentTarget)
选择e.currentTarget
元素中具有entry text
类的所有元素,然后对其调用.text()
资料来源:
.val()用于输入框和窗体
.html()用于选择文本
.val()用于输入框和窗体
.html()用于选择文本
.val()用于输入框和窗体
.html()用于选择文本
.val()用于输入框和窗体
.html()用于选择文本e.currentTarget通常等于此。因此这也可以使用
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', this).text());
}
e.currentTarget通常等于this。因此这也适用
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', this).text());
}
e.currentTarget通常等于this。因此这也适用
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', this).text());
}
e.currentTarget通常等于this。因此这也适用
$(".entry").on('dblclick', function(e) {
e.preventDefault();
// Get the statement into the edit box at the top
$("#statement").val($('.entry-text', this).text());
}
$('.entry text').text()代码>是的,这可以工作,但问题是我在页面上有几个,所以它应该是e事件$(this.find('.entry text').text()中的.entry文本代码>$('.entry text').text()代码>是的,这可以工作,但问题是我在页面上有几个,所以它应该是e事件$(this.find('.entry text').text()中的.entry文本代码>$('.entry text').text()代码>是的,这可以工作,但问题是我在页面上有几个,所以它应该是e事件$(this.find('.entry text').text()中的.entry文本代码>$('.entry text').text()代码>是的,这可以工作,但问题是我在页面上有几个,所以它应该是e事件$(this.find('.entry text').text()中的.entry文本代码>