How can I grab the Html for $(this) in a following function
allhdn.each(function (){
var $this = $(this);
var newHtml = (str + $this.html());
});
$(this).html() returns empty string.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$(this).html()gets the inner html code for the tag. Because the tags you’re iterating over are input fields, they don’t have any inner tags. To fix this, I think you need to wrap in a new tag and take the inner html of that tag:But as @Interstellar_Coder noted, are you sure you want the HTML, and not just the
.val()on the hidden inputs?