0
按鈕嵌套在這樣的方式:通過
$(document).on("click" , ".down-arrow" , function() {
});
<div>
<div>
<div class="this is the div I am after">
<!-- To get this text -->
</div>
<div class="down-arrow" id="10">
<!-- this is the div that has the arrow button -->
<img src="downarrow.png" id="10down" width="100%" height="auto">
<img src="uparrow.png" style="display:none" class="upArrow" id="10up" width="100%" height="auto">
</div>
</div>
該按鈕被觸發所以我呼應行和每一行都有一個唯一的標識符。
所選的按鈕位於div內,因此當我點擊按鈕時,我無法在包含該按鈕的div內獲得一段文本。
所以我用.outerHTML
它顯示我以後的id,我怎麼才能專門選擇使用.outerHTML
信息的按鈕外部的id?
var selectedDiv = document.getElementById(selectedId).outerHTML;
哪一行以及哪個後面的ID ..看起來像我的http://xyproblem.info – vinayakj
您已標記jQuery,但您使用的是JavaScript。你是否也在使用jQuery? –
按鈕在哪裏? – Varun