mardi 30 janvier 2018

Laravel - Disable option value after selecting it once

I have a form in my project that a user is using to fill up an application. In this form I have a table with details about user's language skill. Also, in my project I have a seeder with all the languages that are shown in an option select in the table.

How can I disable one of the languages after it has been selected once?

This are some samples of my code:

HTML:

<td id="resource_profile_languages">
  <select  class="form-control form-select" id="resource_profile_language_" name="resource_profile_language_" placeholder="Language">
    @foreach($languages as $r=>$language)
      <option  value="" ></option>
    @endforeach
  </select>
</td>

this is my script way of adding a new language in the table:

function addNewLanguage(){
    var count = $('#resource_profile_language_table').children('tr').length;

    var select_language = $('#resource_profile_languages')
                            .children([CONST_ENGLISH_ID])
                            .clone()
                            .attr('id', idResourceProfileLanguage.concat(count))
                            .attr('name', idResourceProfileLanguage.concat(count));


    $('#resource_profile_language_table').append($('<tr>').append( $('<td id="resource_profile_languages_' + count + '" name="resource_profile_languges_' + count + '">').append(select_language)));
  }



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DQHua3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire