Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
onblur: <input type="text" id="input-on-blur" placeholder="on blur" onblur="myFunctionBlur();">
<br>
onchange: <input type="text" id="input-on-change1" placeholder="on change" onchange="myFunctionChange1();">
<br>
onchange(with value): <input type="text" id="input-on-change2" value="already has text" onchange="myFunctionChange2();">
</body>
</html>
 
function myFunctionBlur() {
  var onBlurStr = document.getElementById('input-on-blur').value;
  if (onBlurStr.length === 0 || onChangeStr.length === 0) {
    alert('Plaease enter a value !');
  }
}
function myFunctionChange1() {
  var onChangeStr = document.getElementById('input-on-change1').value;
  if (onChangeStr.length === 0) {
    alert('Plaease enter a value !');
  }
}
function myFunctionChange2() {
  var onChangeStr = document.getElementById('input-on-change2').value;
  if (onChangeStr.length === 0) {
    alert('Plaease enter a value !');
  }
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers