var describeElements = function (elClass, $obj) {
var $temp = $obj.closest('td').find('input[type="hidden"]')
.clone().wrapAll('<div/>').parent();
var $temp2 = $obj.closest('td').find('select')
.clone().wrapAll('<div/>').parent();
$(elClass + ':first').val($temp.html());
$(elClass + ':last').val($temp2.html());
$temp.remove();
$temp2.remove();
}
var catParms = {
defOptionTxt: 'Please select one...', // */ false , // false is not OEM
autoSelect: true, // deprecated. always true now -> false didn't make sense due to best practices on branch lengths
style: {
width: '300px',
display: 'block'
}, // 5.4 defaults for category
splitValTxt: "val" // doesn't matter for a custom field
};
// chain it jquery-style on the OEM custom field
$('#fields\\[custom_field_value0\\]').catStyleFromCustomSelect(catParms);
$custom = $('select[id*="value0"]:last');
$custom.closest('td')
.on('change', 'select', function () {
describeElements('.textarea1', $(this));
}) // end on bubbled change
describeElements('.textarea1', $custom);
var statusParms = {
defOptionTxt: false, // false , // false is OEM on built-in fields
autoSelect: true, // deprecated. always true now -> false didn't make sense due to best practices on branch lengths
style: {
width: '300px',
display: 'block'
}, // 5.4 defaults for category
splitValTxt: "txt" // doesn't matter for a custom field
};
$('#fields\\[status_id\\]').catStyleFromCustomSelect(statusParms);
$sel = $('select[id*="status"]:last');
$sel.closest('td')
.on('change', 'select', function () {
describeElements('.textarea2', $(this));
}) // end on bubbled change
.find('select:last').trigger('change');
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.