Why does this not work?
var me = $('#'+id);
var content = $(me).find('input').val().serialize();
I get TypeError: $(me).find("input").val().serialize is not a function
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.
Because
$(me).find('input').val()is a string and not a jQuery object, it doesn’t have the serialize function.If you want to serialize the input (with its value), use
$(me).find('input').serialize();But be sure to really need it : this function is rarely useful for just one input (we generally use it for forms). If you just want the value, use
$(me).find('input').val()and if you’re debugging and want to inspect the element, useconsole.log($(me))and open the console of your browser.