如何获取值onchange函数并在使用javascript

时间:2018-05-07 20:45:55

标签: javascript jquery html

嗨我有输入类型的表。当用户输入值时,它会触发OnChange函数,(1)如图所示。运行以下代码



$(document).on("change", ".goalsdata", function(e) {
  debugger;
  var type = $(e.target).parent().parent().parent().parent().children().children().first().children()[0].innerHTML;

  console.log("Checked Value:", type);
});




当用户点击“提交我的目标”时在" onChange"中收集的按钮类型值函数应传递给" onClick"作为参数的函数



$(document).on("click", "#goals_update_bt", function(type) {
      debugger;

      var commit_button = type;

      console.log("this", commit_button)
      e.preventDefault();
      var weekYear = getYearWeekFromDatePicker();
      var datauid = $("#emplist").val()
      //var datauid= {{uid_val}}
      console.log("datauid:", datauid)
      console.log(" weekYear: " + weekYear.year);
      var mkrequest = {
        "request": {
          gen: {
            //crm_activity_goals : ["CRM","External","Internal"]
            crm_activity_goals: commit_button
          },
          goals: {
            "monday": {
              "day": "mon"
            },
            "tuesday": {
              "day": "tue"
            },
            "wednesday": {
              "day": "wed"
            },
            "thursday": {
              "day": "thu"
            },
            "friday": {
              "day": "fri"
            },
            "stnd": {
              "day": "stnd"
            }
          },
          week: {
            week_number: weekYear.week,
            year: weekYear.year
          },
          uid: datauid

        }
      };




figure

你能帮忙吗?

0 个答案:

没有答案