Skip to main content
adicionou 156 caracteres ao conteúdo
Fonte Link
RDyego
  • 385
  • 1
  • 6
$(document).ready(function() {
  $(".campo-formulario").on("keydown change", function() {
    var elem = $(this);
    var siblings = elem.siblings();
    if (elem.val().length > 0) {
      siblings.addClass('focused');
    } else {
      siblings.removeClass('focused');
    }
  });
});

alterei:

document.getElementById('logradouro').value = (conteudo.logradouro);

para:

 $("#logradouro").val(conteudo.logradouro).keydown();

Coloquei no plunker, testa aqui

$(document).ready(function() {
  $(".campo-formulario").on("keydown change", function() {
    var elem = $(this);
    var siblings = elem.siblings();
    if (elem.val().length > 0) {
      siblings.addClass('focused');
    } else {
      siblings.removeClass('focused');
    }
  });
});

Coloquei no plunker, testa aqui

$(document).ready(function() {
  $(".campo-formulario").on("keydown change", function() {
    var elem = $(this);
    var siblings = elem.siblings();
    if (elem.val().length > 0) {
      siblings.addClass('focused');
    } else {
      siblings.removeClass('focused');
    }
  });
});

alterei:

document.getElementById('logradouro').value = (conteudo.logradouro);

para:

 $("#logradouro").val(conteudo.logradouro).keydown();

Coloquei no plunker, testa aqui

Fonte Link
RDyego
  • 385
  • 1
  • 6

$(document).ready(function() {
  $(".campo-formulario").on("keydown change", function() {
    var elem = $(this);
    var siblings = elem.siblings();
    if (elem.val().length > 0) {
      siblings.addClass('focused');
    } else {
      siblings.removeClass('focused');
    }
  });
});

Coloquei no plunker, testa aqui