Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $do_toggle = "onClick="javascript:toggle('togglenote');"";
- echo form_radio('decision'.$key,'y',FALSE,$do_toggle)."Yes ";
- echo form_radio('decision'.$key,'n',FALSE,$do_toggle)."No";
- echo form_input($mytext);
- // I put a div tag around the form_input above
- // but it's not showing in the StackOverflow question...
- // but it's there for the toggle to work.
- <input type="checkbox" name="decisionY" value="y" /> Yes
- <input type="checkbox" name="decisionN" value="N" /> Yes
- <input type="text" id="togglenote" name="togglenote" />
- $(document).ready(function(){
- $(":checkbox[name^='decision']").change(function(){
- if($(this).is(":checked")){
- $(":checkbox[name[^='decision']").attr("checked", false); //Uncheck the other
- $(this).attr("checked", true);
- $("#togglenote").show();
- }
- if($(":checkbox[name^='decision']:checked").size() == 0){
- $("#togglenote").hide();
- }
- });
- });
- $("#checkbox1").change(function() {
- if ($(this).attr("checked") && $("#checkbox2").attr("checked")) {
- $("checkbox2").removeAttr("checked");
- } else if ($(this).attr("checked")) {
- $("#inputfield").show();
- } else {
- $("#inputfield").hide();
- }
- });
- $("#checkbox2").change(function() {
- if ($(this).attr("checked") && $("#checkbox1").attr("checked")) {
- $("checkbox1").removeAttr("checked");
- } else if ($(this).attr("checked")) {
- $("#inputfield").show();
- } else {
- $("#inputfield").hide();
- }
- });
Add Comment
Please, Sign In to add comment