function fn fieldValue function successful if this is select var resul

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function($) {
$.fn.fieldValue = function(successful) {
if ($(this).is("select")) {
var result = [];
result = $("> option:selected", $(this)).each(function() {
result.push($(this).val())
});
}
else if ($(this).is("input[type=checkbox]")) {
var result = [];
$(this).filter(":checkbox[checked]").each(function() {
result.push($(this).val());
});
}
else if ($(this).is("input[type=radio]")) {
result = $(this).filter(":radio[checked]").val()
}
if (typeof(result) == "undefined") {
result = "";
}
return result;
}
})(jQuery);