有没有办法将此元素标题<i title="" id='thei' class='fa fa-check-square-o'></i>
设置为等于另一个元素innerHTML?
E.g。 <i title="(#tooltip).innerHTML" id='thei' class='fa fa-check-square-o'></i>
假装这是#tooltip:<p id="tooltip">Make this text a title of #thei</p>
答案 0 :(得分:0)
尝试使用.attr()
,将#thei
"title"
设置为#tooltip
.html()
$("#thei").attr("title", $("#tooltip").html())
$("#thei").attr("title", $("#tooltip").html())
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<p id="tooltip">Make this text a title of #thei</p>
<i title="" id='thei' class='fa fa-check-square-o'>thei</i>