{"id":500,"date":"2022-08-30T15:02:23","date_gmt":"2022-08-30T15:02:23","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/it-does-not-allow-me-to-select-buttons-if-something-is-entered-in-textbox-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:02:23","modified_gmt":"2022-08-30T15:02:23","slug":"it-does-not-allow-me-to-select-buttons-if-something-is-entered-in-textbox-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/it-does-not-allow-me-to-select-buttons-if-something-is-entered-in-textbox-collection-of-common-programming-errors\/","title":{"rendered":"it does not allow me to select buttons if something is entered in textbox-Collection of common programming errors"},"content":{"rendered":"<p>Open the browser console. When you click a button, you&#8217;ll see the following error:<\/p>\n<pre><code>Uncaught ReferenceError: currenttotal is not defined\n<\/code><\/pre>\n<p>It&#8217;s thrown by this line of code:<\/p>\n<pre><code>console.log(currenttotal);\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/VAL2n.png\" \/><\/p>\n<p>There&#8217;s another problem which appears to be preventing <code>currenttotal<\/code>&#8216;s initialization:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/DHYMk.png\" \/><\/p>\n<p>If I put a breakpoint at this line: <code>var letter = $('#numberAnswerTxt').val();<\/code> (inside of <code>getButtons<\/code>), I can see that the variable <code>\"letter\"<\/code> is a string that looks like <code>\"3\"<\/code>. Strings do not have a property named <code>String<\/code>, so <code>letter.String<\/code> is undefined. This is why the <code>TypeError: Cannot call method 'fromCharCode' of undefined<\/code> is thrown.<\/p>\n<p>So I <em>think<\/em> that <code>for<\/code> loop should go something like this:<\/p>\n<pre><code>for(var i = 65; i<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 20:01:28. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Open the browser console. When you click a button, you&#8217;ll see the following error: Uncaught ReferenceError: currenttotal is not defined It&#8217;s thrown by this line of code: console.log(currenttotal); There&#8217;s another problem which appears to be preventing currenttotal&#8216;s initialization: If I put a breakpoint at this line: var letter = $(&#8216;#numberAnswerTxt&#8217;).val(); (inside of getButtons), I can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-500","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=500"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/500\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}