kumar naik
asked on
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>
Another version
<script>
$(function(){
$('table:hidden').each(function(i, e) {
$(e).closest('.border').removeClass('border');
})
})
</script>
ASKER
how to remove if it is an ID border not class border
ASKER
how to write if the table is in the display:none position. not in hidden
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry forgot to close solution was very helpful thanku
You are welcome.
Open in new window