1675
| <![CDATA[<script>
$("#person-type-pf").change(function() {
$('.pj').hide();
$('.pf').show();
});
$("#person-type-pj").change(function() {
$('.pf').hide();
$('.pj').show();
});
var token = '7lrq59VHTGCLeqhynBBmDshY0qw1KIIZCYxJKQA1';
$('select[name="state"]').on('change', function() {
var state_id = $(this).val();
$.ajax({
type: 'POST',
url: "https://www.pocodantas.pb.gov.br/cms/ajax/get/acidade/by/state",
data: {
_token: token,
state_id: state_id
},
success: function(response) {
$('select[name="cities_id"]').removeAttr('disabled');
$('select[name="cities_id"]').empty().append($('<option>').text('Selecione a Cidade')
.val(''));
$('select[name="state"]')[0][0].setAttribute('value', 'placeholder');
if(state_id != 'placeholder') {
$('select[name="cities_id"]').removeAttr('disabled');
} else {
$('select[name="cities_id"]').setAttribute('disabled', false)
}
$.each(response, function(id, city) {
$('select[name="cities_id"]').append($('<option>').text(city).val(id));
});
},
error: function(error) {
$('select[name="cities_id]"]').removeAttr('disable');
}
});
});
$("input[name='phone_number']").ready(function() {
var tamanho = $("input[name='phone_number']").val().length;
if (tamanho < 15) {
$("input[name='phone_number']").mask("(99) 9999-9999");
} else if (tamanho >= 15) {
$("input[name='phone_number']").mask("(99) 99999-9999");
}
});
$("input[name='phone_number']").focus(function() {
$("input[name='phone_number']").mask("(99) 99999-9999");
});
$("input[name='phone_number']").on('change', function() {
var tamanho = $("input[name='phone_number']").val().length;
if (tamanho < 15) {
$("input[name='phone_number']").mask("(99) 9999-9999");
} else if (tamanho >= 15) {
$("input[name='phone_number']").mask("(99) 99999-9999");
}
});
</script>]]>
|