开发者

Copying the contents of an H2 tag on a page to a series of spans inside a div

开发者 https://www.devze.com 2023-01-03 04:36 出处:网络
I have an H1 tag on a page with开发者_如何学Python an ID of \"Topic Name <h1 id=\"topicName\"><a href=\"/link here\">News You Can Use</a></h1>

I have an H1 tag on a page with开发者_如何学Python an ID of "Topic Name

<h1 id="topicName"><a href="/link here">News You Can Use</a></h1>

I need to copy the text inside the H1 and apply it to a series of span tags which are inside a div.

<div class="post"> <h2>{tag_postdate} <span class="topicName2"> </span></h2></div>

I need to get "News you can Use" and copy it inside each instance of .topicName2

Any help would be appreciated!


Something like:

$('.topicName2').text($('#topicName').text());

Reference: .text()

0

精彩评论

暂无评论...
验证码 换一张
取 消