Skip to content Skip to sidebar Skip to footer

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 matched selector

$(document).ready(function() {
  $("button").click(function() {
    $(this).next("p").toggle();
  });
});
.myTable {
  width: 100%;
  text-align: left;
  background-color: lemonchiffon;
  border-collapse: collapse;
}
.myTableth {
  background-color: #FFD300;
  color: white;
}
.myTabletd,
.myTableth {
  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: 10px10px10px10px;
  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
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><tableclass="myTable"><tr><th>Assignment</th><th>Points</th><th>Assignment</th><th>Points</th></tr><tr><td>Some text
      <buttonclass="button">Read more</button><pstyle="display: none"align="justify">Some Explanation
      </p><td>5</td><td>Some other text
        <buttonclass="button">Read more</button><pstyle="display: none"align="justify">Other Explanation
        </p><td>5</td></tr></table>

Post a Comment for "Multiple Toggle Buttons Html"