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
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, use console.log($(me))
and open the console of your browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With