6

$.and?

so I have a var that containssome jquery object which contains some elements (in this case <a> elements)

var elements = $('a');

I then want to add some other elements (in this case <b> elements) to this string when using a click function for instance...

elements.and('b').on("click", function(){
    //some random code
});

Any way to do this?

0

1 Answer 1

12

Are you looking for add ?

elements.add('b')....

Note that $('a, b'); would do too.

Sign up to request clarification or add additional context in comments.

1 Comment

Bingo! So hard to find a function like this when the only keywords I can think to use is jquery and "and". Will mark as correct in about 6 minutes

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.