Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.6/ember.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <script type="text/x-handlebars">
  {{view App.TextFieldEmpty}}
  </script>
</body>
</html>
 
App = Ember.Application.create();
App.TextFieldEmpty = Ember.TextField.extend({
  focusOut: function() {
    var valid = this.get('value') ? valid = true : valid = false;
    this.$().next(".err").remove();
    if(!valid){
      this.$().addClass("invalid").after("<span class='err'>This field is required</span>");
    } else {
      this.$().removeClass("invalid")
    }
  }
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers