0

how i have following piece of code:

var $form = $(form);
$fields = $form.find('input[name]');
$selects = $form.find('select');

How can i concat $selects to $fields? I want inputs and selects in one JQuery Object.

1
  • Are you mixing PHP and JavaScript in there? Commented Feb 20, 2015 at 11:12

2 Answers 2

1

as you have created the jquery object of form from variable form. variable form should be dom object.

Then you can use comma separated multiple elements:

var $objects= $(form).find('input[name],select');
Sign up to request clarification or add additional context in comments.

Comments

0

You should wrap form in " ... "

var $objects= $("form").find('input[name],select');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.