1) Script Title: Loop through form fields and get text value of select option
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...formwizard.htm
3) Describe problem: I am using the code below which works fine. But I want to get the text value of the select option not the value.
The line "HELLO THERE THE TEXT IS"+ ip[i].text() " needs something else, not ".text()"
Any ideas please?
Code:var ip = $('form#genform').find('input, select'); t = ""; for (var i = 0; i < ip.length; i++) { if ($(ip[i]).attr("name") =='enginetype') { t+= "<p><span>" + $(ip[i]).prev("label").text() + ":</span> HELLO THERE THE TEXT IS"+ ip[i].text() +'</p>' ; //$("#list option:selected").text(); ($(this).val() } else { t+= "<p><span>" + $(ip[i]).prev("label").text() + ":</span> " + ip[i].value+'</p>' ; } } alert("t "+t); $("#datareview").html(t); }



Reply With Quote

Bookmarks