Answers for "input receber focus"

6

unity focus input field

MyInputField.Select();
MyInputField.ActivateInputField();
Posted by: Guest on December-02-2020
0

form validation focusin focusout

var name = $('#name').val();
var validName = false;
$('#name').focusin(function(event){
    event.preventDefault();
    if (!validName) {
      $(this).val('');
      $(this).css({ 'border-color': '#fff',
                    'color': 'black'});
    }else if (validName && $(this).val().length >= 4) {
      validName = true;
      name = $('#name').val();
      $(this).val(name);
      $(this).css({ 'border-color': '#fff',
                    'color': '#000'});
    }
  });

  $('#name').focusout(function(){
    if ($(this).val().length <= 3) {
      $(this).val('Minimum 4 characters!');
      $(this).css({ 'border-color': '#cc0000',
                    'color': '#cc0000'});
      validName = false;
    }else if ($(this).val().length >= 4){
      validName = true;
      name = $('#name').val();
      $(this).val(name);
    }
  });
Posted by: Guest on February-19-2020

Browse Popular Code Answers by Language