MDB Select Trigger jQuery Change Event


Topic: MDB Select Trigger jQuery Change Event

Paul King pro asked 6 years ago

Hi,
I'm trying to trigger a jquery on change event when a value from an MDB Select is changed but I can't seem to get this to work.

Any suggestions of what I need to add as the select arguments? 

(The select code obviously is changed by mdboostrap code on load).

Thanks

 

HTML MDB Select Div


<div class="col-md-4 category-dropdown">
<select class="mdb-select" id="category" name="category">
<option value="" selected>Product Category</option>
<?php echo($selectCat); ?>
</select>
</div>

Javascript

$('.category-dropdown .select-dropdown').change(function(){
alert('Test');
}




Sebastian Kaczmarek staff pro premium answered 6 years ago

Your `<select>` element does not have the `.select-dropdown` class. Try adding it and everything should work properly


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.1.1
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: Yes
  • Provided link: No
Tags