简体   繁体   中英

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. I want to have style updated for the last child 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. 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. 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');
            }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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