When selected from the list, it gave out an empty line?

  • 0
    When choosing another from the list, it produced an empty string to fill
    <select атрибуты>
            <option атрибуты>Школа №121</option>
            <option атрибуты>Школа №122</option> 
            <option атрибуты>Школа №125</option>
            <option атрибуты>Школа №126</option>
            <option атрибуты>Школа №127</option>
            <option атрибуты>Школа №128</option>
            <option атрибуты>Школа №135</option>
    
            <option value="другое" атрибуты>Другое</option>
    JavaScript Anonymous, May 16, 2019

  • 1 Answers
  • 0
    if (document.querySelector ('# select'). value == '0') {

    document.querySelector ('. input-text'). classList.add ('show');

    }



    Accordingly - where #select is a select (dropdown) in which values ​​are selected.

    .value - value to be checked for non-strict equality, where 0 - can be any default value.

    .input-text is an element that is hidden by default in html (display: none, for example). Add the show class to it, which will show the block with the text.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!