internet explorer - Output all form variables in javascript (similar to php's print_r()) -
i'm looking output form names , associated variables in alert box me debug something. i'd use firebug or whatever problem exists on ie (and ie developer tools don't seem helpful in case.)
i'm guessing need loop i'm not sure how provide array of form keys..
thanks, john.
using json + jquery:
var formobject = {}; $('form input, form textarea, form select').each(function(){ formobject[$(this).attr('name')] = $(this).val(); }); alert(json.stringify(formobject));
edit: in action http://jsfiddle.net/rapvf/
note: ie 7 , below need include json2.js
Comments
Post a Comment