Announcement

Collapse
No announcement yet.

User HTML checkbox

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • User HTML checkbox

    Hi, I have a control with User HTML (as an external library), in which I defined a checkbox.
    This checkbox appears correct, I can add an Ajax Onclick-event, so I can use this checkbox to set an option in the application.

    Now I would like to have the ability to hide the checkbox, sc_field_display does not seem to work correctly, so I wondered whether anyone has an idea to hide such a checkbox?

    thanks, regards,
    Glenn

  • #2
    with CSS display: none?

    Comment


    • #3
      Hi,

      any example on how to achieve it? It needs to be possible to modify the visibility at runtime.
      I'd like to hide the checkbox if a certain condition is met.

      thanks, regards
      Glenn

      Comment


      • #4
        HTML Code:
        IF (condition_of_if){
           echo '<script>#id_of_the_checkbox{display: none;}</script>';
        }

        Comment


        • #5
          Originally posted by nonkelmike View Post
          HTML Code:
          IF (condition_of_if){
          echo '<script>#id_of_the_checkbox{display: none;}</script>';
          }
          You've mixed up CSS and JS here.

          CSS
          Code:
          <style>
          /* CSS */
          input[type=checkbox] .class-of-checkbox {
          display: none;
          } /* OR */ #id-of-the-checkbox {
          display: none;
          } </style>
          JS/jQuery
          Code:
          <script>
          // assuming jQuery is enabled
          if ( $( '#id-of-the-checkbox' ).length !== undefined && $( '#id-of-the-checkbox' ).length !== 0) { // check if the checkbox exists with the length method
          if ( *** SOME CONDITION HERE *** ) {
          $( '#id-of-the-checkbox' ).hide(); // to hide $( '#id-of-the-checkbox' ).show(); // to show $( '#id-of-the-checkbox' ).toggle(); // to toggle between hide and show
          }
          } </script>

          Comment


          • #6
            indeed, it should ve been STYLE!

            Comment

            Working...
            X