Help! ” Is causing undefined errors in my project

help!-”-is-causing-undefined-errors-in-my-project

Yes, I do know that is an escape character. I am writing a code for a keyboard, and I have to have the key , of course. Now, the problem is, that this key must have a data attribute, which I put as \. Then, when the keys are updated, the JS changed the value to undefined, and everything goes downhill from there. Here is my code:


  
    
  
  
    
     id="keyboard">
      
       data-key="`">`
       data-key="1">1
       data-key="2">2
       data-key="3">3
       data-key="4">4
       data-key="5">5
       data-key="6">6
       data-key="7">7
       data-key="8">8
       data-key="9">9
       data-key="0">0
       data-key="-">-
       data-key="+">+
       data-key="backspace" data-exclude="true">Backspace
       data-key="tab" data-exclude="true">Tab
       data-key="q">q
       data-key="w">w
       data-key="e">e
       data-key="r">r
       data-key="t">t
       data-key="y">y
       data-key="u">u
       data-key="i">i
       data-key="o">o
       data-key="p">p
       data-key="[">[
       data-key="]">]
       data-key="\">
       data-key="caps" data-exclude="true">Caps Lock
       data-key="a">a
       data-key="s">s
       data-key="d">d
       data-key="f">f
       data-key="g">g
       data-key="h">h
       data-key="j">j
       data-key="k">k
       data-key="l">l
       data-key=";">;
       data-key="'">'
       data-key="enter" data-exclude="true">Enter
       data-key="shift" data-exclude="true">Shift
       data-key="z">z
       data-key="x">x
       data-key="c">c
       data-key="v">v
       data-key="b">b
       data-key="n">n
       data-key="m">m
       data-key=",">,
       data-key=".">.
       data-key="https://dev.to/">/
       data-key="shift" data-exclude="true">Shift
       data-key="space" data-exclude="true">Space
    
id="output" placeholder="Type something...">

https://jsfiddle.net/oxmzsrqe/

I tried several things, amoung which were:

  • Using one escape character ().
  • Using multiple escape characters (\\).
  • Using HTML entities (\ and others)
  • Changing my JS code to handle undefined, convert data to a string, and many other things.
Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
million-3.0:-all-you-need-to-know

Million 3.0: All You Need To Know

Next Post
machine-learning-for-automation-&-quality-inspection

Machine Learning for Automation & Quality Inspection

Related Posts