I\'m doing a validation with Jquery and need to get the $label from each element with their own label. Now the alert() gives med [object object]. The best thing for me here
Instead of below line:
var $label = $("label[for='"+$element.attr('id')+"']"
Use the following code:
var $label = $("label[for='"+$element.attr('id')+"']").text();
You are getting only the object you need to use the .html() or .text() to get the text inside the label tag.
.html()
.text()