嗨,我是这个网站的新手,我试图在我的论坛中获得一个标题,而不是在论坛中再次粘贴它 < div class="titleBar" >
所以基本上我需要的是一些代码,例如,可以获取该 div 中的内容
http://desiztv.com/index.php?threads/watch-colors-live-online-for-free.68/
标题是“免费在线观看颜色直播”我需要一些代码,我将在帖子中发布,它会自己获得标题,我可以在每个帖子中做到这一点,请帮助我谢谢 :)
嗨,我是这个网站的新手,我试图在我的论坛中获得一个标题,而不是在论坛中再次粘贴它 < div class="titleBar" >
所以基本上我需要的是一些代码,例如,可以获取该 div 中的内容
http://desiztv.com/index.php?threads/watch-colors-live-online-for-free.68/
标题是“免费在线观看颜色直播”我需要一些代码,我将在帖子中发布,它会自己获得标题,我可以在每个帖子中做到这一点,请帮助我谢谢 :)
You could simply store the text value in a variable to use wherever you want...
<div id="mainTitle>Watch Colors Live Online For Free</div>
Using jQuery and JavaScript, we initialize a new variable called title
.
var title = '';
Now as soon as your text has been inserted into your #mainTitle
div element, you can retrieve the text content of that div using this -
title = $("#mainTitle").text();
Your title
variable is then available for you to use anywhere you want to copy that text -
$("#someElement, #anotherElement, #yetAnotherElement").text(title);
All three elements -
<div id="someElement">Watch Colors Live Online For Free</div>
<div id="anotherElement">Watch Colors Live Online For Free</div>
<div id="yetAnotherElement">Watch Colors Live Online For Free</div>
will now contain the same text as the first #mainTitle
element.