Here is the page where there is a check for the existence of cookies, if there are no cookies, then a block with text should be displayed. Now this block is hidden, but when clicked, it should appear using jquery. The block is not displayed that is not correct?

<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript"> $.cookie('name', 'Тимур', { expires: 30 }); var test = $.cookie('name'); if (test) { $('#name').css('display', 'block'); }else{ } </script> <style media="screen"> .hello1 { background: #000; height: 100%; opacity: 0.7; position: fixed; width: 100%; top: 0; left: 0; z-index: 100; display: none; } .hello { background-color:#FFFFFF; height: 200px; position: fixed; top: 100px; left: 40%; color: #000000; width: 300px; } </style> </head> <body> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <h1>HEllo</h1> <div class="hello1" id="name"> <div class="hello" id="popup"> <p>Текст в окне</p> </div> </div> </body> </html> 
  • In general, more than one <h1> tag on the page should not be - And
  • This is for example, instead there will be recordings - Suslik85
  • For example, you need to make a normal example. - And

1 answer 1

 if (test) { // Здесь элемента с id="name" еще нет. $(function(){ // А здесь - уже есть. $('#name').css('display', 'block'); }); }else{ } 

And, of course, the jQuery library should be inserted into the page above your script tag.