Hello. There are 2 checkboxes and 1 select. It is necessary that when choosing "M" or "F", as well as when choosing a certain age, an alert pops up. Here is the code:
<!DOCTYPE html> <html> <body> Выберите пол: М<input type="checkbox" name="me" id="men"> Ж<input type="checkbox" name="wu" id="wum"> <br/> Выберите возраст: <select id="mySelect"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> </select> <br/><br/> <button onclick="myFunction()">Рассчитать</button> <script> function myFunction() { var v = document.getElementById("mySelect").selectedIndex; if (v<11) {alert("Подросток");} else if ($('#men').prop('checked') && v>12 && v<20) {alert("Юноша");} else if ($('#men').prop('checked') && v>20) {alert("Мужчина");} else if ($("#wum").prop("checked") && v>12 && v<20) {alert("Девушка");} else if ($("#wum").prop("checked") && v>20) {alert("Женщина");} } </script> </body> </html> Who can say what is wrong? Alert does not appear at all. But if you remove the check-box from the branch, everything works