Is there a way in jQuery to determine if an element has a value or innerhtml (or both)? For example, if an element is entered, then it has a value of val, and I can use:
$(this).val();
But if it is a div, I need to use:
$(this).html();
I need to know if I need to use val or HTML. My jQuery part:
$(".myclass").each(function(idx){ if (this is a val based element) use val else use html });
source share