当没有任何我知道使用ID,Class使用的方式时,如何剪贴数据document.getElementsByClassName
。
<tr id="overview-summary-current">
<th scope="row">
<span class="edit-tools">
<a href="#background-experience" class="edit-section" id="control_gen_5">Edit experience
</a>
</span>
<a href="#background-experience" data-trk="prof-0-ovw-curr_pos">Current</a>
</th>
<td>
<ol>
<li>
<strong>
<a href="/company/10097785?trk=prof-0-ovw-curr_pos" dir="auto">SNT Solutions rajkot</a>
</strong>
</li>
</ol>
</td>
</tr>
我想要SNT Solutions rajkot
如何使用JavaScript在变量中获取该值。
trk=prof-0-ovw-curr_pos
在网页中是唯一的
我对此有简单的解决方案
var a1 = document.querySelector('a[href$="trk=prof-0-ovw-curr_pos"]').text;
console.log('Data is :::::'+a1);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句