tags:

views:

25

answers:

2

JQuery - Can we capture both the p and div tags at a time in a single sentence using jquery?

+3  A: 

......

$('p, div')..........

Just separate each item with a comman (,).

Alternatively, you could use the add function:

$('p').add('div')..........
Sarfraz
+1 I always used .add, never knew about the ,
Plynx
@Plynx: Thanks .............
Sarfraz
+4  A: 

Use the comma selector:

$("div, p")...

or add():

$("div").add("p")...
cletus