Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript to hide multiple div

I have multiple div all start with expense. I am able to hide them all with below formula

$("[id^='expense']").hide();

But I have a requirement to exclude one of the div start with expense. This one will change depends upon other functions so I can not change the name.

Is there anyway I can exclude a specific one( for example expense_one)

like image 315
acr Avatar asked Jan 02 '23 17:01

acr


1 Answers

By using not you can do this:

$("[id^='expense']").not('#expense_one').hide();

Update: id is specified using #

like image 50
Anees Hikmat Abu Hmiad Avatar answered Jan 04 '23 07:01

Anees Hikmat Abu Hmiad