Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
select2 clear option is not display properly

I have a problem with my select2 plugin, the clear option is not display properly

The css has not been modified. What could the problem be ?

exemple

The HTML

<div class="form-group <?PHP if(form_error('moa')) echo 'has-error'; ?>">
<div class="row">
    <label>Maitre d'ouvrage <span class="text-danger">*</span></label>
    <a href="<?=base_url('societe/ajouter?moa')?>" target="_blank"><p style="float:right;">Ajouter une société</p></a>
</div>
<select class="select-search-ajax" data-url="<?=base_url('societe/moa_json')?>" name="moa">
<?PHP
    foreach($societeMoa as $row) {
        if($chantier->moa==$row->id_contact) {
            ?>
            <option value="<?PHP echo $row->id_contact; ?>" selected="selected"><?PHP echo mb_strtoupper($row->nom_societe).' ('.$row->nom_contact.' '. $row->prenom_contact.')'; ?></option>
            <?PHP
        }
    }
    ?>
</select>
<?php echo form_error('moa','<span class="help-block">','</span>'); ?>
</div>

JS :

$(document).ready(function(){
$('.select-search-ajax').each(function(){
    $(this).select2({
        ajax: {
          url: $(this).attr("data-url"),
          dataType: 'json'
        }, 
        placeholder: 'Selectionnez...',
        allowClear: true,
      });
});
});

CSS :

.select2-selection--single .select2-selection__clear {
position: relative;
  cursor: pointer;
  float: right;
  font-size: 0;
  line-height: 1;
  margin-top: 2px;
  margin-left: 5px;
  opacity: 0.75;
  filter: alpha(opacity=75);
}

As I said I dit not edit the css.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I solved my problem by removing some css, in this class .select2-selection__clear:after I removed : content: '\ed6b'; font-family: 'icomoon';

And in this class .select2-selection__clear : I changed font-size: 0; by font-size: 1em;

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!