Faced such a problem, is it possible to do logical operators in the object search in jquery

Here is the code itself, an example:

$('.block_from input.form_ajax || select.form_ajax').click(function() { //my code }); 

That is, in the parent .block_from you need to take either input.form_ajax or select.form_ajax, depending on the click?

Or do you need hardcode and write more code? And this is not a hyphen jquery.

  • A comma is used as a delimiter. - And

1 answer 1

 $('.block_from input.form_ajax, .block_from select.form_ajax')... $('.block_from').find('input.form_ajax, select.form_ajax')... $('input.form_ajax, select.form_ajax', $('.block_from'))...