【发布时间】:2015-08-01 04:48:38
【问题描述】:
任何人都知道我怎样才能得到 p>
这是我的html标签:
<div id="grade_contamina">
<ul id="ul_element">
<!---My first li--->
<li id="first_id">
<p>
Apple
</p>
<!---Button for apple---->
<span class="fruits" id="btn_apple">
<a class="btn_send_once">Send to Students</a>
<a class="btn_delete_once" >Delete</a>
<a class="btn_download_once">Download</a>
</span>
</li>
<!---My second li--->
<li id="second_id">
<p>
Grapes
</p>
<!---Button for grapes---->
<span class="fruits" id="btn_grapes">
<a class="btn_send_once">Send to Students</a>
<a class="btn_delete_once" >Delete</a>
<a class="btn_download_once">Download</a>
</span>
</li>
</ul>
</div>
每个 LI 元素都有 3 个按钮,删除、发送和下载。 让我们从“apple LI element”说起,我点击了删除。我需要根据它的 id 删除这个 LI 元素,或者我想根据它的 id 发送这个基础。现在如何获取 LI 的 id 或者获取 LI 元素的 ID 的最佳方法是什么?
除了获取 id 之外,我还想在单击按钮删除时触发 JQUERY 效果。
I want this happen if the button delete is clicked.
**Remove the LI element which is clicked
**Apped a new LI element at the last LI element of ul using "FadeIn Effect".
这是我的伪代码
if button is clicked{
var the_id = get the id of LI where the button is clicked
now which one of button is clicked?
if button send is clicked{
some code here, i will need here the id to send...
}else if button download is clicked{
some code here, i will need here the id too..
}else if button delete is clicked{
remove the LI element (With fadeOut effect if possible)
append a new LI element at the end of LI whith fadeIn effect
}
//End of Statement
}
有人可以帮助我吗?我对 jQuery 的了解很少,因此将不胜感激。谢谢!!!
【问题讨论】:
-
你好,li base 是什么意思?
-
this.id 应该可以解决问题。
标签: javascript php jquery html css