jquery - get html content after changing selectbox value -
i using following function catch div content.
function gethtml(div) { div.find("input").each(function () { $(this).attr("value", $(this).val()); }); return div.html(); }
and catching data following
var updatesearchcontent = gethtml($('#someform'));
but if there select box in div , change value, function catch initial state default value.
how can solve this? if change select box value should save the change value default.
if have select in div need bind change event values when change:
$('#someform').on('change','selecttags', function() { alert( $(this).find(":selected").val() ); });
note select allow multiple values selected , return might array of values.
check boxes , radio buttons need considered if included in form have different set of values.
just note question:
$('select').prop("type");
will return either "select-one" or "select-multiple" depending upon "multiple" attribute
see question full discussion on input type detection: how input type using jquery?
Comments
Post a Comment