简体   繁体   English

jQuery(this).parent()。parent()。parent()。find()在iPad中不起作用

[英]jQuery(this).parent().parent().parent().find() not working in iPad

I have the below JSP code in which tr has ID and last child td has ID. 我有以下JSP代码,其中tr具有ID,最后一个子td具有ID。 I want to have style updated for the last child td. 我想为最后一个孩子的td更新样式。 How could i do this: 我该怎么做:

<tr class="${rowClass}" id="${loopStatus.index}" >
    <td>....</td>
    <td>....</td>    
    <td id="uploadedDiv" >
                    <div id="success" style="display:none">
                    <div class="floatLeft selectWidth15">
                        <div class="available"></div>
                        </div>
                    <div class="floatLeft selectWidth85 greenText"><fmt:message key="opusmx.upload.uploaded" /></div>
                    <div class="clear"></div>
                    </div>
                    <div id="failure" style="display:none">
                    <div class="floatLeft selectWidth15">
                    <div class="notAvailable"></div>
                    </div>
                    <div class="floatLeft selectWidth85 redText"><fmt:message key="opusmx.upload.captureFailed" /></div>
                    <div class="clear"></div>
                    </div>
    </td>
  </tr>

The below function works only on web browsers but not as an app in iPad. 以下功能仅适用于Web浏览器,不适用于iPad中的应用程序。 Can someone help me on this: 有人可以帮我吗:

function showStatus(elementID,thisObj,status){
                if (status == 'success') {
                    jQuery(thisObj).parent().parent().parent().find('#uploadedDiv').find('#success').css('display', 'block');
                } else {
                    jQuery(thisObj).parent().parent().parent().find('#uploadedDiv').find('#failure').css('display', 'block');
                }
        }

I solved the issue by using the id of tr tag. 我通过使用tr标签的ID解决了该问题。 It found out the children and set the required style: 它找出了孩子并设置了所需的样式:

function showStatus(elementID,thisObj,status){
            if (status == 'success') {
                jQuery('#'+elementID).find('#uploadedDiv').find('#success').css('display', 'block');
            } else {
                jQuery('#'+elementID).find('#uploadedDiv').find('#failure').css('display', 'block');
            }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM