how to check if input type is radio using jquery

That should work as long as the elements are loaded.

// Ensure the DOM is ready
$(function() {
    if ($('#myElement').is(':radio')) {
        //code here
    }
});

If you’re assigning handlers based on type, another approach would be to use .filter().

$(function() {
    var el = $('#myElement');
    el.filter(':radio').change(function() {
        //code here
    });

    el.filter(':checkbox').change(function() {
        // other code here
    });
});

If it doesn’t pass the filter(), the handler won’t be assigned.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)