jquery.collection.js
function (selector) {
            try {
                var jqElem = $(selector);
            } catch (e) {
                return null;
            }
            if (jqElem.length === 0) {
                return null;
            } else if (jqElem.is('input[type="checkbox"]')) {
                return (jqElem.prop('checked') === true ? true : false);
            } else if (jqElem.is('input[type="radio"]') && jqElem.attr('name') !== undefined) {
                return $('input[name="' + jqElem.attr('name') + '"]:checked').val();
            } else if (jqElem.prop('value') !== undefined) {
                return jqElem.val();
            } else {
                return jqElem.html();
            }
        }
function (selector) {
            try {
                var jqElem = $(selector);
            } catch (e) {
                return null;
            }
            if (jqElem.length === 0) {
                return null;
            } else if (jqElem.is('input[type="checkbox"]')) {
                return (jqElem.prop('checked') === true ? true : false);
            } else if (jqElem.is('input[type="radio"]') && jqElem.attr('name') !== undefined) {
                return $('input[name="' + jqElem.attr('name') + '"]:checked').val();
            } else if (jqElem.prop('value') !== undefined) {
                return jqElem.val();
            } else {
                return jqElem.html();
            }
        }
function ( selector ) { try { var jqElem = $ ( selector ) ; } catch ( e ) { return null ; } if ( jqElem . length === 0 ) { return null ; } else if ( jqElem . is ( 'input[type="checkbox"]' ) ) { return ( jqElem . prop ( 'checked' ) === true ? true : false ) ; } else if ( jqElem . is ( 'input[type="radio"]' ) && jqElem . attr ( 'name' ) !== undefined ) { return $ ( 'input[name="' + jqElem . attr ( 'name' ) + '"]:checked' ) . val ( ) ; } else if ( jqElem . prop ( 'value' ) !== undefined ) { return jqElem . val ( ) ; } else { return jqElem . html ( ) ; } }
return a field value whatever the field type
return a field value whatever the field type