{"id":12029,"date":"2022-09-29T09:49:38","date_gmt":"2022-09-29T04:19:38","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/"},"modified":"2022-09-29T09:49:38","modified_gmt":"2022-09-29T04:19:38","slug":"solved-settimeout-is-not-showing-text","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/","title":{"rendered":"[Solved] setTimeout is not showing text"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-52951949\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"52951949\" data-parentid=\"52951663\" data-score=\"-1\" data-position-on-page=\"3\" data-highest-scored=\"0\" data-question-has-accepted-highest-score=\"0\" itemprop=\"suggestedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>I&#8217;m typing with my mobile phone and I don&#8217;t have access to a tool for writing the complete code easily, but look at this mistakes in your code:<\/p>\n<ol>\n<li>You must Add <code>document.<\/code> before any <code>getElementById<\/code> in your code.<\/li>\n<li>You must wrap <code>visible<\/code> between &#8221; &#8220;:  <code>document.getElementById('bro').style.visibility = \"visible\"<\/code>;<\/li>\n<li>What is <code>set<\/code> (in <code>set.setTimeout<\/code>)? remove it from before of  <code>setTimeout()<\/code>.<\/li>\n<li>What is <code>n.toString()<\/code>?. you must assign it, no using it directly: <code>.innerHTML=n.toString()<\/code> <\/li>\n<li>Put <code>while<\/code> in <code>setInterval()<\/code><\/li>\n<li>You have used <code>visibility<\/code> in <code>popup<\/code> function and <code>display<\/code> in another place (for change visibility of <code>bro<\/code>). Use one of them in your code (<code>css<\/code> and <code>js<\/code> and <code>html<\/code>);<\/li>\n<li>Use <code>document.querySelector('[name=\"block\"]').style.display = \"none\";<\/code> for hiding the <code>block<\/code> elem.<br \/>\n8- Change <code>z-index<\/code> of <code>#texto<\/code> to 3.<\/li>\n<\/ol>\n<hr>\n<p><strong>Updated part:<\/strong><\/p>\n<p>Now, you can test the result here. <strong>this is your code itself<\/strong> that its problems have been solved:<\/p>\n<\/p>\n<div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\n<div class=\"snippet-code\">\n<pre class=\"snippet-code-css lang-css prettyprint-override\"><code>#bro {\r\n  position: absolute;\r\n  left: 50px;\r\n  top: 150px;\r\n  visibility: hidden;\r\n  justify-content: center;\r\n  z-index: 3;\r\n  font-size: 20px;\r\n}\r\n\r\n#texto {\r\n  position: absolute;\r\n  justify-content: center;\r\n  transition: none;\r\n  background-color: inherit;\r\n  padding: inherit;\r\n  z-index: 3;\r\n  font-size: 20pt;\r\n}\r\n\r\naside {\r\n  position: absolute;\r\n  justify-content: center;\r\n  width: 600px;\r\n  height: 500px;\r\n  background-color: blue;\r\n  border-radius: 30px;\r\n  z-index: 2;\r\n}<\/code><\/pre>\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code> &lt;body onload='popup()'&gt;\r\n  &lt;p id=\"texto\" color=\"red\"&gt;3&lt;\/p&gt;\r\n  &lt;button id=\"bro\" onclick=\"bro()\"&gt;close&lt;\/button&gt;\r\n  &lt;aside name=\"block\"&gt;&lt;\/aside&gt;\r\n  &lt;script&gt;\r\n    var n = 3;\r\n    function popup() {\r\n      setTimeout(function() {\r\n        document.getElementById('bro').style.visibility=\"visible\";\r\n      }, 3000);\r\n\r\n      var t2=setInterval(function() {\r\n        debugger\r\n        if(n--==0) clearInterval(t2);\r\n        else document.getElementById(\"texto\").innerHTML=n+\"\";\r\n      }, 1000);\r\n\r\n    }\r\n\r\n    function bro() {\r\n      document.getElementById('bro').style.visibility = \"hidden\";\r\n      document.getElementById('texto').style.display = \"none\";\r\n      document.querySelector('[name=\"block\"]').style.display = \"none\";\r\n    }\r\n  &lt;\/script&gt;\r\n&lt;\/body&gt;<\/code><\/pre>\n<\/div>\n<\/div><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">1<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved setTimeout is not showing text <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] I&#8217;m typing with my mobile phone and I don&#8217;t have access to a tool for writing the complete code easily, but look at this mistakes in your code: You must Add document. before any getElementById in your code. You must wrap visible between &#8221; &#8220;: document.getElementById(&#8216;bro&#8217;).style.visibility = &#8220;visible&#8221;; What is set (in set.setTimeout)? remove &#8230; <a title=\"[Solved] setTimeout is not showing text\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/\" aria-label=\"More on [Solved] setTimeout is not showing text\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[389,346,333,388],"class_list":["post-12029","post","type-post","status-publish","format-standard","hentry","category-solved","tag-dom","tag-html","tag-javascript","tag-jquery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Solved] setTimeout is not showing text - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] setTimeout is not showing text - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] I&#8217;m typing with my mobile phone and I don&#8217;t have access to a tool for writing the complete code easily, but look at this mistakes in your code: You must Add document. before any getElementById in your code. You must wrap visible between &#8221; &#8220;: document.getElementById(&#039;bro&#039;).style.visibility = &quot;visible&quot;; What is set (in set.setTimeout)? remove ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-29T04:19:38+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] setTimeout is not showing text\",\"datePublished\":\"2022-09-29T04:19:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/\"},\"wordCount\":127,\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"keywords\":[\"dom\",\"html\",\"javascript\",\"jquery\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/\",\"name\":\"[Solved] setTimeout is not showing text - JassWeb\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\"},\"datePublished\":\"2022-09-29T04:19:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/solved-settimeout-is-not-showing-text\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] setTimeout is not showing text\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#website\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/#\\\/schema\\\/person\\\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206\",\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206\",\"contentUrl\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/wp-content\\\/litespeed\\\/avatar\\\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\\\/\\\/jassweb.com\"],\"url\":\"https:\\\/\\\/jassweb.com\\\/solved\\\/author\\\/jaspritsinghghumangmail-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] setTimeout is not showing text - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] setTimeout is not showing text - JassWeb","og_description":"[ad_1] I&#8217;m typing with my mobile phone and I don&#8217;t have access to a tool for writing the complete code easily, but look at this mistakes in your code: You must Add document. before any getElementById in your code. You must wrap visible between &#8221; &#8220;: document.getElementById('bro').style.visibility = \"visible\"; What is set (in set.setTimeout)? remove ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/","og_site_name":"JassWeb","article_published_time":"2022-09-29T04:19:38+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] setTimeout is not showing text","datePublished":"2022-09-29T04:19:38+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/"},"wordCount":127,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["dom","html","javascript","jquery"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/","url":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/","name":"[Solved] setTimeout is not showing text - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-09-29T04:19:38+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-settimeout-is-not-showing-text\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] setTimeout is not showing text"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1777613206","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/12029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=12029"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/12029\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=12029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=12029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=12029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}