Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Detect backspace pressed eventlistener

document.addEventListener("keydown", function(event) 
{
  if (event.key == "c") 
  {
    console.log("C Pressed");
    document.getElementById("btnConvert").click();
  }

  var convertButton = document.getElementById("btnConvert");
  if (event.key == "Backspace") 
  {
    console.log("Backspace Pressed");
    var textboxContent = document.getElementById("txtFahrenheit").value;
    if (textboxContent.value == "" || textboxContent.value == "-")
    {
      convertButton.disabled = true;
    }
  }
})

/*HTML:
<button id="btnConvert">Convert</button>
<input id="txtFahrenheit" type="text" autofocus />
*/
Comment

PREVIOUS NEXT
Code Example
Javascript :: escaping less than great than signs in react 
Javascript :: function reducer sintaxe 
Javascript :: javaascript localStorage get number, not string 
Javascript :: javascript map array values to single vars 
Javascript :: Grad points by javascript switch 
Javascript :: show hide pseudo element jquery 
Javascript :: safari technology 
Javascript :: how to use moment in angular 8 
Javascript :: destructuring interfaces in the most simple way <<Java Script 
Javascript :: play 2 audio react 
Javascript :: tictactoe using Jquery 
Javascript :: javascript random number between 0 and 30 
Javascript :: undo pwa 
Javascript :: date pretty print javascript 
Javascript :: add validation in strapi 
Javascript :: build function component react 
Javascript :: js import 
Javascript :: Answer the following questions by identifying what unit of measurement to be used. 2pts. Brainly 
Javascript :: Das komplette JavaScript in den Footer laden 
Javascript :: javascript llenar array con objetos 
Javascript :: how to get html paramater in js 
Javascript :: alert(document.cookie); 
Javascript :: second level relationships data not found in strapi 
Javascript :: cant find variable idbindex react native 
Javascript :: provider._web3Provide.sendAsync as any 
Javascript :: jquery switch css style sheets 
Javascript :: convert typescript to js online 
Javascript :: indexable values js 
Javascript :: typeorm sqlite Using Repositories 
Javascript :: new http version ANGULAR 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =