Basically I have several divs, each contains a question. This question could be presented with either single input, radio buttons or checkboxes.
I want to identify what the input type is, when looping through the divs.
the following code to achieve this doesn’t work, just trying to demonstrate what I am trying to achieve.
$(".question").each(function(){
var type = $(this).children('input').attr("type").val();
alert(type);
});
Remove the val():
e.g.