Get element type with jQuery
also you can use:
$("#elementId").get(0).tagName
you should use tagName
property and attr('type')
for inputs
Getting the element type the jQuery way:
var elementType = $(this).prev().prop('nodeName');
doing the same without jQuery
var elementType = this.previousSibling.nodeName;
Checking for specific element type:
var is_element_input = $(this).prev().is("input"); //true or false