Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-…
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Political Decision Engine</title>
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
- <script>
- $(document).ready(function () {
- $("input[type=checkbox]").change(function (evt) {
- var isChecked = $(this).is(":checked");
- var index = $("#my_table input[type=checkbox]").index(this);
- var div = $("#result div").eq(index);
- console.log(div);
- console.log(isChecked);
- if (isChecked) {
- div.show();
- }
- else {
- div.hide();
- }
- });
- });
- </script>
- <style>
- *
- {
- margin: 0;
- padding: 0;
- }
- html
- {
- font: 16px "Segoe UI" , "Segoe WPC" , Helvetica, Arial, "Arial Unicode MS" , Sans-Serif;
- }
- div
- {
- float: left;
- }
- #result div
- {
- display: none;
- float: none;
- }
- </style>
- </head>
- <body>
- <form action="" method="post" name="question1" target="_self">
- <table border="1">
- <th colspan="2" align="center" bgcolor="#FF9900">
- Political Decision Engine
- </th>
- <tr>
- <td bgcolor="#F5D69A">
- Question one:
- </td>
- <td rowspan="4" width="150" bgcolor="#F4DA88">
- Image goes here
- </td>
- </tr>
- <tr>
- <td bgcolor="#F5E8CB">
- <table border="1" id="my_table">
- <tr>
- <td width="100">
- <input type="checkbox" name="question_1" />
- Option 1
- </td>
- <td width="100">
- <input type="checkbox" name="question_1" />
- Option 2
- </td>
- <td width="100">
- <input type="checkbox" name="question_1" />
- Option 3
- </td>
- <td width="100">
- <input type="checkbox" name="question_1" />
- Option 4
- </td>
- <td width="100">
- <input type="checkbox" name="question_1" />
- Option 5
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td bgcolor="#F5E8CB">
- <p id="no-result">Please select a choice</p>
- <div id="result">
- <div>Enter text for Option 1</div>
- <div>Enter text for Option 2</div>
- <div>Enter text for Option 3</div>
- <div>Enter text for Option 4</div>
- <div>Enter text for Option 5</div>
- </div>
- </td>
- </tr>
- <tr>
- <td bgcolor="#F5E8CB">
- Resourses
- </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment