javascript - 如何使用 JS/JQ/ 从 Marquee 获取值以显示在标签中
问题描述
<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>
解决方案
嗨,您可以使用此代码,如果您遇到任何问题,请告诉我
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>
推荐阅读
- react-bootstrap-typeahead - react-bootstrap-typeahead 缓存的实现细节是什么?
- api - Twopart 嵌入式 API 消息 Discord.py(branch>rewrite)
- r - R在将tbl_summary转换为乳胶时如何删除“__”
- python - 如何添加到变量,然后在达到最大值后循环回 0?
- ansible - terraform apply 后在远程控制节点上执行 ansible playbook
- sse - 128/256 位是否有 1 条指令移位?
- swift - 当我考虑锚点(0.5,0.5)时,为什么我的 SKSpriteNode 会移动这么远?
- python-3.x - Numba 正确实施?
- python-3.x - Python中连接坐标的排序列表
- firebase - 使用 Firebase Cloud Functions,我可以从外部 API 安排更新以更新 Firestore