我的完整日历外部事件显示如下
<?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 } ?>这是我的jquery
$('#external-events2 .fc-event').each(function() {
var str = $(this).context;
$(this).data('event', {
title: $.trim($(this).text()),
stick: true,
color : '#4AC948',
className : "sub",
id : //need to add the id here
});
});我想给每个事件一个特定的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>知道怎么找回它吗。我试过换绳子,但没起作用。
发布于 2015-03-10 13:41:36
你用的是什么活动?例如,如果您使用的是单击事件:
$('.fc-event').click(function(){
//Get the ID
var eventID = $(this).find('input[type="hidden"]').val();
//Do whatever you want with the ID here.
});https://stackoverflow.com/questions/28965111
复制相似问题