if table is dispalyed border should display if it is hidden border should be remove.

how to write if else condition  if table is displayed  border "class" should add . and if table is not displayed border  ''"class" should remove.
 This is Sample Code only. 
when i am hidding the table border is displayed i want to hide the border when table is hidden. 
<!DOCTYPE html>
<html>
<head>
	<title></title>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<style type="text/css">
		.border{
			border:1px solid red;
		}
	</style>

	<script type="text/javascript">
		$(document).ready(function(){
			if ($(table) == display:none) {
				$(table).removeClass("border")
			}
		})
	</script>



</head>
<body>

	<div class="border">
		<table>
			<thead>
				<th>2121321</th>
				<th>2121321</th>
				<th>2121321</th>
				<th>2121321</th>
				<th>2121321</th>
				<th>2121321</th>
				<th>2121321</th>

			</thead>
			<tbody>
				<tr>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				</tr>
				<tr>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				</tr>
				<tr>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				</tr>
				<tr>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				<td>2121321</td>
				</tr>

				
			</tbody>
		</table>
	</div>

</body>
</html>

Open in new window

kumar naikGraphic DesignerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
<script>
$(function(){
	if ($('.border table:visible').length == 0) {
		$('.border').removeClass("border")
	}
})
</script>

Open in new window

0
Julian HansenCommented:
Another version
<script>
$(function(){
	$('table:hidden').each(function(i, e) {
		$(e).closest('.border').removeClass('border');
	})
})
</script>

Open in new window

0
kumar naikGraphic DesignerAuthor Commented:
how to remove if it is an ID border   not class border
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

kumar naikGraphic DesignerAuthor Commented:
how to write if the table is in the display:none position. not in hidden
0
Julian HansenCommented:
how to remove if it is an ID border   not class border
$(e).closest('#border').removeClass('border');

Open in new window

how to write if the table is in the display:none position. not in hidden
:hidden applies to display: none not to visibility:hidden
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kumar naikGraphic DesignerAuthor Commented:
sorry forgot to close solution was very helpful thanku
0
Julian HansenCommented:
You are welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.