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.