簡體   English   中英

為什么jQuery不更改為html src中顯示的colspan ot?

[英]Why isn't jQuery changes to colspan ot showing in html src?

我有一個jQuery方法,可根據用戶角色修改colspan屬性。 當我擔任其他所有角色時,該功能和jQuery方法可正常工作,但是作為查看者角色,jQuery表示已進行更改,修改后的colspan的td元素中的onclick方法表示已更改,但html src並未更改並根據顯示還原為原始值。

Java功能

    function changeFooterLength(action,tableType,role)
    {
    if(role != "viewer"){
    if(action == "show"){
        $("#footer_filler").attr("colspan",13);
    }else if(action == "hide"){
        if(tableType != "Search"){
            $("#footer_filler").attr("colspan",10);
        }else{
            $("#footer_filler").attr("colspan",10);
        }
    }
    }else{
    if(action == "show"){
        $("#footer_filler").attr("colspan",12);
    }else if(action == "hide"){
        alert($('#footer_filler').attr('colspan'));
        $("#footer_filler").attr("colspan",9);
        alert($('#footer_filler').attr('colspan'));
    }
    }
    }

td元素:

    <td id="footer_filler" colspan="12" class="table_footer_excel" align="left" onclick="alert($('#footer_filler').attr('colspan'));">
        <a href="<c:url value='/export'/>">
     <img src="<c:url value="/resources/images/icon_microsoftexcel.png"/>" style="width: 20px; height: 20px; margin-left: 5px; border: none;" />
    </a>
     </td>

在我看來,邏輯似乎很扎實,但沒有用,有人可以幫我理解原因嗎?

您需要在瀏覽器的開發人員工具中使用DOM檢查器。 源是服務器源的“原始”源,當通過JavaScript / jQuery修改DOM時,源將不會發生任何更改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM