简体   繁体   English

在jQuery-UI选项卡中访问oldPanel隐藏的HTML变量

[英]Access oldPanel hidden HTML variable in jQuery-UI Tab

I am using jQuery 1.6.2 and jQuery-ui 1.9.0. 我正在使用jQuery 1.6.2和jQuery-ui 1.9.0。 I have some tabs like these: 我有一些这样的标签:

<li><a href="#document-tab" onclick="return documentTabGet('CRFilingDocument.do', null);">Documents</a></li>
<li><a href="#litigant-tab" onclick="return litigantTabGet('CRFilingLitigantDetail.do', null)">Litigants</a></li>
<li><a href="#scheduling-tab" onclick="return schedulingTabGet('CRFilingScheduling.do', null);">Scheduling</a></li>

I have setup a beforeActivate function 我已经设置了一个beforeActivate函数

jQuery("#reviewtabs").tabs({ 
    select:
        function (event, ui) {
            return CheckSomething();
        },

    show: 
        function (event, ui) { 
            //do some stuff
        },
    beforeActivate: 
        function( event, ui ) {
        return CheckSomething();
    }

});

On the JSP that renders one of those tabs I would like to check a hidden HTML input in the beforeActivate. 在呈现这些选项卡之一的JSP上,我想检查beforeActivate中的隐藏HTML输入。 In Chrome console I can see the HTML from typing ui.oldPanel, how get access to the hidden fields value? 在Chrome控制台中,我可以通过键入ui.oldPanel来查看HTML,如何访问隐藏字段值? I have tried ui.oldPanel.find("dirtyCheck").value and it comes back undefined. 我已经尝试过ui.oldPanel.find(“ dirtyCheck”)。value,但返回的结果不确定。

Thanks, 谢谢,

Tom 汤姆

Ok, if ui.oldPanel is not undefined, we need to know what dirtyCheck is. 好的,如果ui.oldPanel不是未定义的,我们需要知道什么是dirtyCheck Is it the input id ? 输入的ID吗? the input css class ? 输入CSS类? or something else ? 或者是其他东西 ?

If dirtyCheck is the id of the <input id="dirtyCheck" type="hidden" value="..."/> you are looking for, you can get its value using an id selector and the .val() method : 如果dirtyCheck是您要查找的<input id="dirtyCheck" type="hidden" value="..."/>ID ,则可以使用ID选择器.val()方法获取其值:

ui.oldPanel.find('#dirtyCheck').val();

If dirtyCheck is its css class, use a css selector and the .val() method : 如果dirtyCheck是其css类,请使用css选择器.val()方法:

ui.oldPanel.find('.dirtyCheck').val();

If the returned value is still undefined, double-check that your input is really in the ui.oldPanel :) and give us the html where the input is. 如果返回的值仍然不确定,请仔细检查您的输入是否确实在ui.oldPanel :)中,并为我们提供输入位置的html。

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

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