How to join two jQuery element objects? .add() isn’t working

add() creates (and returns) a new jQuery object that is the union of the original set and what you’re adding to it, but you’re still returning the original in your function. You seem to have wanted to do this instead:

function getInput() {
    $hiddenInput = $('<input type="hidden">');
    //(other code)
    $select = $('<select></select>');
    //(other code)
    return $hiddenInput.add($select);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)