ejs-chiplist selected value pass in OnChage Event

I am using syncfusion for displaying the list of subjects.

<ejs-chiplist id="chip-SubjectTags" selection="Single" click="FilterSubject" cssClass="e-primary">
@foreach (var mySubject in (List<FilterSubjectInfo>)ViewBag.FilterTags)
<e-chip text="@mySubject.Name" value="@mySubject.SubjectTagID" enabled="true"></e-chip>

When selecting the subject let’s say MATHS OR SCIENCE it calls the function FilterSubject(e) and fetch the data.

Now I have one dropdown list in which I have a list of Teacher’s names.

<select class="form-control" id="selectTeacher" onchange="getTeacherVideo(this)">
function getTeacherVideo(selectObject) {
var value = selectObject.value;
//var abcValue = document.getElementById('chip-SubjectTags').selectObject;

Here in getTeacherVideo() function I want to use the chip-SubjectTags, selected chip value.

How can I access chip-SubjectTags chip value in Javascript.


You can achieve your requirement by using the getSelectedChips method of Chip component as demonstrated in the below code snippet,

<ejs-chiplist id="chip-avatar" click="FilterSubject" selection="Single" enableDelete="true">
    . . .
<select name="cars" id="cars" onchange="getTeacherVideo(this)">
function getTeacherVideo(selectObject) {
    var chip = document.getElementsByClassName('e-chip-list')[0].ej2_instances[0];//Chip instance.
    var selected = chip.getSelectedChips(); //to get the value of the selected chip

API Reference: https://ej2.syncfusion.com/javascript/documentation/api/chips/chipList/#getselectedchips