小编Des*_*nds的帖子

在bootstrap模式窗口中提交表单时创建fullCalendar日历事件

我有一个fullCalendar实现,我试图创建一个引导模式窗口,点击日历上的任何地方,然后保存日历条目"在模式窗口中"提交"表单.

$(document).ready(function() {
    var calendar = $('#calendar').fullCalendar({
    //header and other values
    select: function(start, end, allDay) {
        var endtime = $.fullCalendar.formatDate(end,'h:mm tt');
    var starttime = $.fullCalendar.formatDate(start,'ddd, MMM d, h:mm tt');
    var mywhen = starttime + ' - ' + endtime;
        $('#createEventModal #when').text(mywhen);
        $('#createEventModal').modal('show');
     },
    //other functions
  });
Run Code Online (Sandbox Code Playgroud)

这是模态屏幕的HTML:

<div id="createEventModal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h3 id="myModalLabel1">Create Appointment</h3>
    </div>
    <div class="modal-body">
    <form id="createAppointmentForm" class="form-horizontal">
        <div class="control-group">
            <label class="control-label" for="inputPatient">Patient:</label>
            <div class="controls">
                <input type="text" …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui fullcalendar twitter-bootstrap

7
推荐指数
1
解决办法
2万
查看次数

根据值选中或取消选中具有相同类名的所有复选框

我在多个div中有以下复选框.

<div class="div1">
    <input type="checkbox" class="chkbox" value="101"> This is 101
    <input type="checkbox" class="chkbox" value="102"> This is 102
    <input type="checkbox" class="chkbox" value="103"> This is 103
</div>
<div class="div2">
    <input type="checkbox" class="chkbox" value="110"> This is 110
    <input type="checkbox" class="chkbox" value="102"> This is 102
    <input type="checkbox" class="chkbox" value="101"> This is 101
</div>
Run Code Online (Sandbox Code Playgroud)

如上所示,一些复选框在多个div上具有相同的值(例如,101).现在,每当选中复选框时,我都需要检查具有相同值的其他复选框.同样,取消选中.

$(".chkbox").change(function() {
    // If checked
    if (this.checked)
           // find other checkboxes with same value and check them
    else
           // find other checkboxes with same value and uncheck them
}
Run Code Online (Sandbox Code Playgroud)

jquery jquery-selectors

6
推荐指数
1
解决办法
1万
查看次数