Get form data with Javascript/Jquery from dialoguebox -


i have dialogue box this

$("#dbsetting_div").dialog({     height: 315,     width: 500,     autoopen: false,     modal: true,     draggable: false,     buttons: {         "save": function () {},         "add more": function () {             l_i++;             formhtml = "<div>";             formhtml += "<form id='" + l_i + "'>";             formhtml += "<label class = 'dbright'>dashboard id: </label><span class = 'dbleft'><select id='dashboard_id' class='dbsettingdd'><option>-------select-------</option>" + dropdowndashboardname + "</select></br></span>";             formhtml += "<label class = 'dbright'>filtering parameter: </label><span class = 'dbleft'><select id='filter_by'><option>-------select-------</option></select></br></span>";             formhtml += "<label class = 'dbright'>y-axis: </label><span class = 'dbleft'><select id='yaxis'><option>-------select-------</option></select></br></span>";             formhtml += "<label class = 'dbright'>chart tiltle: </label><span class = 'dbleft'><input type='text' id='title'/></br></span>";             formhtml += "<label class = 'dbright'>chart type: </label><span class = 'dbleft'><input type='text' id='chart_type'/></br></span>";             formhtml += "<label class = 'dbright'>main chart: </label><span class = 'dbleft'><input type='radio' name='mainchart' value='yes'/>yes <input type='radio' name='mainchart' value='no'/>no</br></span>";             formhtml += "</form>";             formhtml += "</div>";             $("#dbsetting_div").append("<p>" + formhtml + "</p>");             console.log(scroll);         }     } }).css("font-size", "12px"); 

i trying serialize output of dialogue box json

$("div form").each(function(){ console.log( $(this).serialize() ); }); 

i tried including above code in save button function, output in console blank.

i'm not getting errors.

how form data javascript/jquery

jsbin

i got solution, have here fiddle

if @ console, result.

"save": function () {         var data = new object();         $("div form :input").each(function () {             data[$(this).attr("id")] = $(this).val();         });         console.log(data);     }, 

Comments