2
I want when I click on the radios to call the function, currently this way.
$("input[name='txtCategoria']").on('blur', function(){
var txtCategoria = $(this).val();
$.get('buscar_tipos.php?txtCategoria=' + txtCategoria,function(data){
$('#tipos').html(data);
});
});
However only when I click on the radio and click on another part of the page that appears the query, I wanted that when it clicks it is already executed, I tried so.
$("input[name='txtCategoria']").on("click", function(){
var txtCategoria = $(this).val();
$.get('buscar_tipos.php?txtCategoria=' + txtCategoria,function(data){
$('#tipos').html(data);
});
});
But it didn’t work, someone could help me?
Thanks a lot friend, I’m starting now on Javascript I’m catching a lot kkk.
– Everton Figueiredo
@Evertonfigueiredo glad I could help. Note that I used
this.value
. This code does the same, and faster/simpler than$(this).value();
– Sergio
@Evertonfigueiredo Notes that your example with
click
should work as well (for clicks). You may need to delegate the event. If you have problems says.– Sergio
I only made the change from Blur to change and it worked perfectly.
– Everton Figueiredo