如何在jquery
的以下代碼中選擇包含href="www.dummy.ch"
的標籤。jquery選擇<a>在嵌套div中包含特定href的標籤
我必須用_top
而不是_blank
修改目標屬性。 標籤中沒有設置ID或類屬性。
感謝, 帕特里克
<div class="QvContent" style="width: 485px; height: 26px; overflow: visible; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px; background-color: rgba(255, 255, 255, 1);">
\t <div class="QvGrid" style="width: 485px; height: 26px; overflow: hidden; font-family: Tahoma; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; position: relative; cursor: default;" incontainer="false" fixed_cols_left="1">
\t \t <a style="position: absolute;" href="http://www.dummy.ch" target="_blank" unselectable="on">
\t \t \t <div title="URL " style="left: 0px; top: 0px; width: 389px; height: 13px; text-align: center; color: rgb(54, 54, 54); overflow: hidden; font-style: normal; font-weight: normal; text-decoration: underline; position: absolute; cursor: pointer; background-color: rgba(255, 255, 255, 1);">
\t \t \t \t <div style="left: 0px; top: 0px; width: 389px; height: 13px; border-left-color: rgba(220, 220, 220, 1); border-left-width: 0px; border-left-style: solid; position: absolute;" unselectable="on"/>
\t \t \t \t <div class=" injected" style="padding: 0px 2px; width: 385px; height: 13px;">
\t \t \t \t \t <div title="URL " style="width: 385px; overflow: hidden; white-space: pre; cursor: default; -ms-word-wrap: normal;" unselectable="on">
\t \t \t \t \t \t <a style="display: inline-block;" href="http://www.axeed.ch" target="_blank" unselectable="on">URL</a>
\t \t \t \t \t </div>
\t \t \t \t </div>
\t \t \t </div>
\t \t </a>
\t </div>
</div>
嘗試'$(「a [href^='withyour url']」)' – uzaif
聽起來像是對我功課。爲什麼不查找如何通過屬性值來獲取HTML元素? – mason