<p title="">嗨,你的title</p>
Assign "Hi, your title" to title
滿天的星座2017-06-26 10:56:29
var elem = document.querySelector("p");
elem.setAttribute("title", elem.innerText);
给我你的怀抱2017-06-26 10:56:29
I don’t know what specific function you want, but if you want to assign a value, you can:
<p title="" class="title">赋值啊啊啊啊</p>
<script>
let txt = $('.title').text();
$('.title').attr('title',txt);
</script>