The IE does not operate a crypt, a concealing block



  • HTML:

    <form class = "headerOfsearch" name="search" method="post" action="search.php" >
        <select name="taskOption" id="d1" onchange="searchfordate();">
            <option value="first">Обозначение</option>
            <option value="second">Дата проверки</option>
            <option value="third">Номер акта</option>
            <option value="fourth">Врем. промежуток</option>
        </select>
    

    <input type="search" name="query" placeholder="Поиск"> <button type="submit">Найти</button>

    &lt;section style="display:none;" id="new_form"&gt;
        &lt;input type="date" name="bday"&gt;
        -
        &lt;input type="date" name="lday"&gt;
    &lt;/section&gt;
    

    </form>

    js

     <script async="" type="text/javascript" src="http://yandex.st/jquery/2.0.3/jquery.js"></script>
    <script>
    function searchfordate()
    {
    if(d1.selectedIndex == 3){
    $('#new_form').show();
    }
    else{
    $('#new_form').hide();
    }
    }

    </script>

    I'm thinking, when you choose the menu, you're gonna have to scramble the line for the date. The chrome is fine, but IE11 doesn't work at all. What do we do? I'm really new to this, please help me.



  • We need to correctly define the reference to the drop list.

    function searchfordate()
    {
    //  if(document.getElementById("d1").selectedIndex == 3) // на чистом js
      if($("#d1 option:selected").index() == 3) // на jQuery
      {
        $('#new_form').show();
      }
      else
      {
        $('#new_form').hide();
      }
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <form class = "headerOfsearch" name="search" method="post" action="search.php" >
        <select name="taskOption" id="d1" onchange="searchfordate();">
            <option value="first">Обозначение</option>
            <option value="second">Дата проверки</option>
            <option value="third">Номер акта</option>
            <option value="fourth">Врем. промежуток</option>
        </select>
    

    <input type="search" name="query" placeholder="Поиск"> <button type="submit">Найти</button>

    &lt;section style="display:none;" id="new_form"&gt;
        &lt;input type="date" name="bday"&gt;
        -
        &lt;input type="date" name="lday"&gt;
    &lt;/section&gt;
    

    </form>




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2