Firefox exception ‘JavaScript component does not have a method named: “available”’

“[Exception… \”‘JavaScript component does not have a method named: \”available\”‘ when calling method: [nsIInputStream::available]\”  nsresult: \”0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED)\”  location: \”JS frame :: https://localhost/vendor/jam/jquery/jquery.js :: .send :: line 2\”  data: no]”

Solution: http://stackoverflow.com/a/15844406

Convert object to string JSON.stringify(formData)

Get the previous selected value after a dropdown is changed

(function () {
    var previous;

    $("select[name=test]").focus(function () {
        // Store the current value on focus, before it changes
        previous = this.value;
    }).change(function() {
        // Do soomething with the previous value after the change
        document.getElementById("log").innerHTML = "<b>Previous: </b>"+previous;

        previous = this.value;

        // Unselect dropdown - optional
        $('select[name="test"]').blur();
    });
})();

Select deselect radio button

var thisEl = $(e.currentTarget),
    previousValue = $(e.currentTarget).attr('previousValue'),
    name = $(e.currentTarget).attr('name');

if (previousValue === 'checked') {
    thisEl.removeAttr('checked');
    thisEl.attr('previousValue', false);
} else {
    $('input[name="+name+"]:radio').attr('previousValue', false);
    thisEl.attr('previousValue', 'checked');
}

Select and deselect all checkboxes

var thisEl      = $(e.target),
thisVal     = thisEl.val(),
_class      = thisEl.closest('ul').attr('class'),
selChckbox  = $('ul.'+ _class +' input[type="checkbox"]'),
valLiLen    = $('ul.'+ _class +' li').length - 1,
checkbox    = $('ul.'+ _class +' input[type="checkbox"]');

if (thisVal === 'all') {
if (thisEl.is(':checked') === true) { checkbox.prop('checked', true); }
else { checkbox.prop('checked', false); }
} else {
if (thisEl.is(':checked') !== true) {
$('ul.'+ _class +' li:nth-child(1) input[value="all"]').prop('checked', false);
} else {
if ($('ul.'+ _class +' input[type="checkbox"]:checked').length === valLiLen) {
$('ul.'+ _class +' input[type="checkbox"]').prop('checked', true);
}
}
}