Toggle menu
876
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Make whole cell clickable in single and multi grids: Difference between revisions

From Catglobe Wiki
Phongha (talk | contribs)
Created page with '== Challenge == Normally, the grid question require to click on the check or radiobutton. Now, we want it to register the answer when the user click on the cell. == Example == […'
 
Phongha (talk | contribs)
Line 2: Line 2:
Normally, the grid question require to click on the check or radiobutton. Now, we want it to register the answer when the user click on the cell.
Normally, the grid question require to click on the check or radiobutton. Now, we want it to register the answer when the user click on the cell.
== Example ==
== Example ==
[[Image:OneCheckRequired.png ]]
[[Image:Clickable_cell.gif ]]
 
== Script ==  
== Script ==  
<source lang="javascript" line="1">
<source lang="javascript" line="1">

Revision as of 13:45, 27 January 2010

Challenge

Normally, the grid question require to click on the check or radiobutton. Now, we want it to register the answer when the user click on the cell.

Example

Script

quest.onInit = function()
{
   $(".grid_subquestion_odd,.grid_subquestion_even").click(
            function(evt)
            {
               if(evt.target.nodeName == "INPUT")
                  return true;
               $(this).children("input").click();
               return false;
            });
 }