Multiple chips

Sekra24 pro asked 7 years ago

Hey guys, I want to include 2 material-chip like this into one page: HTML: <div class="col"> <label><?php _e('Include keywords (Add with ENTER)', 'hypertheme');?></label> <div class="chips filter-result-include chips-placeholder"></div> </div> <div class="col"> <label><?php _e('Exclude keywords (Add with ENTER)', 'hypertheme');?></label> <div class="chips filter-result-exclude chips-placeholder"></div> </div> JAVASCRIPT: $('.chips-placeholder.filter-result-include').material_chip({ placeholder: 'Add', secondaryPlaceholder: '+Tag', }); $('.chips-placeholder.filter-result-exclude').material_chip({ placeholder: 'Add', secondaryPlaceholder: '+Tag', }); Now I add a word into the include chip input. As soon as I type in the same keyword into the exclude material chip input it diapears immediately as soon as I hit enter. But hold on it becomes more odd: If I add a word into the exclude chip input, delete it and want to input the same word again it gets deleted immediately!    

Mikołaj Smoleński staff answered 7 years ago

Hi Sekra, Please modify Your js code to look like this:
$('.chips-placeholder.filter-result-include').material_chip({
 placeholder:'Add',
 secondaryPlaceholder:'+Tag',
 data: []
});
$('.chips-placeholder.filter-result-exclude').material_chip({
 placeholder:'Add',
 secondaryPlaceholder:'+Tag',
 data2: []
});
Regards  

Sekra24 pro commented 7 years ago

Thank you! That does the trick ;)

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No