1

My HTML page contains a bootstrap multiple select field:

<select class="form-control bootstrap-select"
    data-style="alpha-grey-300 pt-5 pb-5 pl-10 text-size-mini" multiple
    id="associated.persons"
    data-live-search="true">
</select>

Every time a new set of selection is made, the jQuery change event is not working. When I write this code,

$('#associated.persons').change(function (e) {
        console.log("Input changed !!!!!!!!!!!!!!!");
    });

Nothing is written it the console. I don't know where the problem is exactly.

m.bouali
  • 484
  • 1
  • 4
  • 15

2 Answers2

0

You can't used a point in your id or class name. Actually combine hashtag and point in the same rules says your selector search a bloc with id "associated" and class "persons".

Rename your ID and never used the point in your ID or class name. Used - or _ if your want create an ID or class name with multiple words.

You can doing this:

<select class="form-control bootstrap-select"
    data-style="alpha-grey-300 pt-5 pb-5 pl-10 text-size-mini" multiple
    id="associated-persons"
    data-live-search="true">
</select>

And

$('#associated-persons').change(function (e) {
        console.log("Input changed !!!!!!!!!!!!!!!");
});
Thibault Bach
  • 558
  • 5
  • 8
0
id="associated.persons"

Here is the problem. Use another selector and it will work. In your code jquery will try to bind onChange to item with class 'person' and with id="associated"

Johan Willfred
  • 811
  • 7
  • 14