get checked values for jsTree - submit with form post

前端 未结 11 1667
南笙
南笙 2020-12-14 02:40

I\'m using the jsTree jQuery plugin with the checkbox theme. Does anyone know how to get the selected values with a form post?

Thank you!

11条回答
  •  一生所求
    2020-12-14 02:58

    var selectedElmsIds = [];
    $("#jstree2").find("li").each(function(i, element) { //also includes the ones below 'undetermined' parent
      if ($(this).attr("aria-selected") == "true") {
        selectedElmsIds.push($(this).attr('id'));
      }
    });
    console.log(selectedElmsIds);

提交回复
热议问题