Guest User

Untitled

a guest
Jul 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. $do_toggle = "onClick="javascript:toggle('togglenote');"";
  2.  
  3. echo form_radio('decision'.$key,'y',FALSE,$do_toggle)."Yes ";
  4.  
  5. echo form_radio('decision'.$key,'n',FALSE,$do_toggle)."No";
  6.  
  7. echo form_input($mytext);
  8.  
  9. // I put a div tag around the form_input above
  10. // but it's not showing in the StackOverflow question...
  11. // but it's there for the toggle to work.
  12.  
  13. <input type="checkbox" name="decisionY" value="y" /> Yes
  14. <input type="checkbox" name="decisionN" value="N" /> Yes
  15. <input type="text" id="togglenote" name="togglenote" />
  16.  
  17. $(document).ready(function(){
  18. $(":checkbox[name^='decision']").change(function(){
  19. if($(this).is(":checked")){
  20. $(":checkbox[name[^='decision']").attr("checked", false); //Uncheck the other
  21. $(this).attr("checked", true);
  22. $("#togglenote").show();
  23. }
  24. if($(":checkbox[name^='decision']:checked").size() == 0){
  25. $("#togglenote").hide();
  26. }
  27. });
  28. });
  29.  
  30. $("#checkbox1").change(function() {
  31.  
  32. if ($(this).attr("checked") && $("#checkbox2").attr("checked")) {
  33. $("checkbox2").removeAttr("checked");
  34. } else if ($(this).attr("checked")) {
  35. $("#inputfield").show();
  36. } else {
  37. $("#inputfield").hide();
  38. }
  39. });
  40.  
  41.  
  42. $("#checkbox2").change(function() {
  43.  
  44. if ($(this).attr("checked") && $("#checkbox1").attr("checked")) {
  45. $("checkbox1").removeAttr("checked");
  46. } else if ($(this).attr("checked")) {
  47. $("#inputfield").show();
  48. } else {
  49. $("#inputfield").hide();
  50. }
  51. });
Add Comment
Please, Sign In to add comment