jQuery click事件不是由我的javascript文件处理的

时间:2018-06-18 16:58:50

标签: javascript jquery dialog

我正在使用ASP.NET MVC 4.0为弹出窗口构建我的Web应用程序和jQuery Dialog插件。我打算将我的HTML元素放在div元素中,其中包含id' addDialog'弹出一个弹出窗口。弹出窗口应显示在带有ID的按钮上,并添加'但它不起作用。每当我点击按钮时都没有任何反应。

这是我的观点:

@{
  ViewBag.Title = "TimeSlotDetails";
}
<head>
  <title>TimeSlot</title>

  <link href="~/Scripts/DataTables/datatables.min.css" rel="stylesheet" />
  <link href="@Url.Content("~/Content/Common.css")" rel="stylesheet" type="text/css" />
  <link href="~/Scripts/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.min.css" rel="stylesheet" />
  <script src="~/Scripts/jquery-1.7.2.min.js"></script>
  <script src="~/Scripts/jquery-ui-1.12.1.custom/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
  <script src="~/Scripts/jquery.unobstrusive-ajax.min.js"></script>
  <script src="~/Scripts/DataTables/datatables.min.js"></script>
  <script src="~/Scripts/TimeSlotDetails.js"></script>
</head>

<body>
  <form>
    <div id="addDialog" style="display:none">

      Name<input type="text"/><br/><br/>
      Duration<input type="text"/><br/><br/>
      Type<input type="text"/><br/><br/>
      Frequency<input type="text"/><br/><br/>
    </div>
    <div class="title">Automatic Timetable Generator</div>
    <div class="title-down"></div>

    <table class="option_list">
      <tr>
        <td class="title-down" rowspan="16" colspan="3"></td>
        <td rowspan="16" colspan="5">
          <div></div>
          <div></div>
          <div>@Html.ActionLink("Home", "Home")</div>
          <div>@Html.ActionLink("Preferred Time Slot", "PreferredTimeslot")</div>
          <div>Time Slot Details</div>
          <div>Department Details</div>
          <div>Subject Details</div>
          <div>ClassRoom Details</div>
          <div>Lab Details</div>
          <div>Allot the Slots for each classRoom as per your need</div>
          <div>Teacher Details</div>
          <div>Allot Subjects to Teachers</div>
          <div>Allot Subjects to Labs</div>
          <div>Check ot the Final Result</div>
          <div></div>
          <div></div>
        </td>
        <td rowspan="16" colspan="12">

          <div>Enter the Time slot Details</div>
          <div>
            <span><input id="add" type="button" value="Add" /></span> <span><input id="edit" type="button" value="Edit" /></span> <span><input id="delete" type="button" value="Delete" /></span>
          </div>
          <table id="timeslotdetails">
            <thead>
              <tr>
                <td colspan="3">Name</td>
                <td colspan="3">Duration</td>
                <td colspan="3">Type</td>
                <td colspan="3">Frequency</td>
              </tr>
            </thead>
            <tbody>

            </tbody>
          </table>
          <div> <button id="slotAllottmentSubmit" type="Submit" value="Submit the Data">Submit the Data</button></div>
        </td>
        <td rowspan="16" colspan="3"></td>
      </tr>
    </table>
  </form>
</body>

这是我的JavaScript代码:

$(document).ready(function () {
  $('#timeslotdetails').DataTable();

  $('.option-list #add').click(function () {
    $('#addDialog').css('display:inline');
    $('#addDialog').dialog();
  });
});

我已按正确的顺序包含所有相关文件。

1 个答案:

答案 0 :(得分:1)

我认为jQuery选择器(ll_env) C:\jiaguo\learning_logs>python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, learning_log, sessions Running migrations: Applying learning_log.0003_entry_topic...Traceback (most recent call last): File "manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line utility.execute() File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\core\management\__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv self.execute(*args, **cmd_options) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\core\management\base.py", line 335, in execute output = self.handle(*args, **options) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\core\management\commands\migrate.py", line 200, in handle fake_initial=fake_initial, File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\migrations\executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\migrations\migration.py", line 122, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\migrations\operations\fields.py", line 84, in database_forwards field, File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\backends\sqlite3\schema.py", line 306, in add_field self._remake_table(model, create_field=field) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\backends\sqlite3\schema.py", line 178, in _remake_table self.effective_default(create_field) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\backends\base\schema.py", line 240, in effective_default default = field.get_db_prep_save(default, self.connection) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\models\fields\related.py", line 936, in get_db_prep_save return self.target_field.get_db_prep_save(value, connection=connection) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\models\fields\__init__.py", line 767, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\models\fields\__init__.py", line 939, in get_db_prep_value value = self.get_prep_value(value) File "C:\jiaguo\learning_logs\ll_env\lib\site-packages\django\db\models\fields\__init__.py", line 947, in get_prep_value return int(value) TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime' 是错误的。 我检查过,我没有在HTML中看到任何具有$('.option-list #add')类的元素。

您可以尝试.option-list