Javascript 如何从$(this.context)获取输入值

Javascript 如何从$(this.context)获取输入值,javascript,jquery,input,fullcalendar,contextmenu,Javascript,Jquery,Input,Fullcalendar,Contextmenu,我的完整日历外部事件显示如下 <?php foreach ($plants as $plant) { ?> <div class='fc-event evt'> <input type="hidden" value="<?php echo $plant->hcpd_id;?>" class="abc"> <p class="evt_name"><?php echo $p

我的完整日历外部事件显示如下

<?php foreach ($plants as $plant) { ?>
      <div class='fc-event evt'>
           <input type="hidden" value="<?php echo $plant->hcpd_id;?>" class="abc">
           <p class="evt_name"><?php echo $plant->hcpd_name;?></p>
      </div>
<?php } ?>
我想给每个事件指定一个特定的id。(取自数据库。在隐藏输入字段中给出)

以下是生成的div之一。 我想获取以下$(this.context结果)的隐藏id

<div class="fc-event evt ui-draggable ui-draggable-handle">
    <input type="hidden" value="1" class="abc">
    <p class="evt_name">My Plant 1</p>
</div>

我的工厂1

你知道怎么找回它吗。
我试着换绳子,但没用

您正在使用什么事件?例如,如果您正在使用click事件:

$('.fc-event').click(function(){
    //Get the ID
    var eventID = $(this).find('input[type="hidden"]').val();

    //Do whatever you want with the ID here.

});

您使用的是什么活动?例如,如果您正在使用click事件:

$('.fc-event').click(function(){
    //Get the ID
    var eventID = $(this).find('input[type="hidden"]').val();

    //Do whatever you want with the ID here.

});

$(this.context
)的jQuery在哪里?请显示所有相关的源代码。您可能需要
$(this).find('input.abc').val()
,但是如果不知道从何处获取
,“隐藏ID”很难说?那是什么?@isherwood:His
元素。@newtoj很好,很抱歉我的错误。不知怎的,我给了你一个答案,你对
$(this.context
)的jQuery在哪里?请显示所有相关的源代码。您可能需要
$(this).find('input.abc').val()
,但是如果不知道从何处获取
,“隐藏ID”很难说?那是什么?@isherwood:His
元素。@newtoj很好,很抱歉我的错误。不知何故,我得到了答案thanx,这不是只得到元素的值,而不是
id
?thanx需要帮助。。我尝试了$(this).find('input.def').val(),效果很好。@NewToJS因为ID是PHP中定义的值,从技术上讲,是的,两者都有。这不只是获取元素的值而不是
ID
?Thanx以获取帮助。。我尝试了$(this.find('input.def').val(),结果成功了。@NewToJS因为ID是PHP中定义的值,从技术上讲,是的,两者都是。