Topic: Select option is not update correctly if a option is already select

arthur s free asked 4 years ago

I look for update select option thank's to a Ajax request. It's work's unless a option has been selected by user.

If a option has been selected html continue to be update by request but render stop to be update, i have to refresh page.

function sendAjax($url, $datas = null, $methode="GET") {
        if ($datas != null) {
            // console.log($datas);
                headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
                url: $url,
                type: $methode,
                data: $datas,
                contentType: false,
                cache: false,
                processData: false
            }).done(function (response) {
                $html = '<option value="" disabled selected>Choisissez la taille de votre article</option>';

                for (let i = 0; i < response.length; i++) {
                    $html = $html + '<option value="'+response[i].id+'">'+ response[i].size +' '+ response[i].unit +'</option>';

                $size = $("#size_id")
                $size.children().each(function () {

        else {
            console.error("No data to send !");
            return false;

Tomek Makowski staff answered 4 years ago


If it is material select try to reinitialize its. To do this firstly delete material select

$(".material-select").materialSelect({destroy: true})

then initialize it again


If it doesn't work please show me your full code in the snippet editor:


Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.17.0
  • Device: Desktop
  • Browser: Firefox
  • OS: W10
  • Provided sample code: No
  • Provided link: No