如何使用 JS/JQ/ 从 Marquee 获取值以显示在标签中
Posted
技术标签:
【中文标题】如何使用 JS/JQ/ 从 Marquee 获取值以显示在标签中【英文标题】:how to get value from Marquee to show in lable using JS/JQ/ 【发布时间】:2021-08-20 13:16:24 【问题描述】: <marquee id="marquee_element" class="marquee_element">
<span class="notification_marquee first ">$announcement->announcement1</span>
<span class="notification_marquee second not_sec">$announcement->announcement2</span>
<span class="notification_marquee third not_3rd">$announcement->announcement3</span>
<span class="notification_marquee fourth not_4th">$announcement->announcement4</span>
<span class="notification_marquee fifth not_5th">$announcement->announcement5</span>
</marquee>
我想在屏幕上打印选框值,我还必须在标签上打印
<span id="an_label_1" class="an_label not_fst"></span>
【问题讨论】:
【参考方案1】:您好,您可以使用此代码,如果您遇到任何问题,请告诉我
var label = $('#marquee1');
console.log(label.text());
$('#an_label_1').text(label.text());
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<marquee id="marquee_element" class="marquee_element">
<span class="notification_marquee first " id="marquee1">$announcement->announcement1</span>
<span class="notification_marquee second not_sec">$announcement->announcement2</span>
<span class="notification_marquee third not_3rd">$announcement->announcement3</span>
<span class="notification_marquee fourth not_4th">$announcement->announcement4</span>
<span class="notification_marquee fifth not_5th">$announcement->announcement5</span>
</marquee>
<span id="an_label_1" class="an_label not_fst"></span>
【讨论】:
实际上,我必须在屏幕上滑动的每个选取框值......如果第一个滑动,那么第一个显示在标签上......然后在第二个到来之后,标签会用第二个值更改 您可以动态设置,从marquee中获取值并添加span以上是关于如何使用 JS/JQ/ 从 Marquee 获取值以显示在标签中的主要内容,如果未能解决你的问题,请参考以下文章
jQuery框架使用,jq选择器,jq操作页面内容, jq操作类名,jq操作全局属性,jq获取盒子信息,jq获取位置信息,js/jq页面加载完毕事件,jq事件