Reputation: 279
I am using this plugin:
https://www.jqueryscript.net/demo/Drop-Down-Combo-Tree/
I won't get the id of that how can I do it.?
there no proper documentation available for this. is there any approach i can get it.?
<input type="text" id="justAnotherInputBox"
placeholder="Type to filter" ng-change="showSummery(this)"/>
$scope.showSummery = function (data) {
console.log(data)
};
Upvotes: 0
Views: 1357
Reputation: 1911
if you used bottom code to define combo tree:
var comboTree2;
comboTree2 = $('#justAnotherInputBox').comboTree({
source: dataJson,
isMultiple: false
});
then you can used bottom code to get selected value id:
comboTree2._selectedItem.id
Upvotes: 0
Reputation: 49
You can put an onclick listener on the <li>
below the <input>
:
$('#justAnotherInputBox')
.parents('div.comboTreeWrapper')
.find('div.comboTreeDropDownContainer')
.on('click','li.ComboTreeItemChlid',function() {
var id=$(this).find('span').attr('data-id');
/* the rest of your code */
});
Note the typo "ComboTreeItemChlid". It is also in the plugin.
Upvotes: 1
Reputation: 1078
Try This,
<input type="text" id="justAnotherInputBox"
placeholder="Type to filter" ng-change="showSummery()"/>
$scope.showSummery = function () {
console.log(document.getElementById("justAnotherInputBox").value)
};
Upvotes: 1