Multiple Toggle Buttons Html
So I am trying to get my toggle buttons to work but I encountered an annoying problem. First off I found a solution using bootstrap, but the website framework I'm using doesn't sup
Solution 1:
Use
$(this).next(SELECTOR)
to select next element of the same level with matchedselector
$(document).ready(function() {
$("button").click(function() {
$(this).next("p").toggle();
});
});
.myTable {
width: 100%;
text-align: left;
background-color: lemonchiffon;
border-collapse: collapse;
}
.myTable th {
background-color: #FFD300;
color: white;
}
.myTable td,
.myTable th {
padding: 10px;
border: 1px solid goldenrod;
vertical-align: top;
}
.button {
border: 1px solid #d7dada;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
font-size: 12px;
font-family: arial, helvetica, sans-serif;
padding: 10px 10px 10px 10px;
text-decoration: none;
display: inline-block;
color: #000000;
background-color: #f4f5f5;
background-image: -webkit-gradient(linear, left top, left bottom, from(#f4f5f5), to(#dfdddd));
background-image: -webkit-linear-gradient(top, #f4f5f5, #dfdddd);
background-image: -moz-linear-gradient(top, #f4f5f5, #dfdddd);
background-image: -ms-linear-gradient(top, #f4f5f5, #dfdddd);
background-image: -o-linear-gradient(top, #f4f5f5, #dfdddd);
background-image: linear-gradient(to bottom, #f4f5f5, #dfdddd);
filter: progid: DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#f4f5f5, endColorstr=#dfdddd);
}
</s
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<table class="myTable">
<tr>
<th>Assignment</th>
<th>Points</th>
<th>Assignment</th>
<th>Points</th>
</tr>
<tr>
<td>Some text
<button class="button">Read more</button>
<p style="display: none" align="justify">Some Explanation
</p>
<td>5</td>
<td>Some other text
<button class="button">Read more</button>
<p style="display: none" align="justify">Other Explanation
</p>
<td>5</td>
</tr>
</table>
Post a Comment for "Multiple Toggle Buttons Html"