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

with CSS display: none?

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

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

You’ve mixed up CSS and JS here.

CSS


<style>
/* CSS */
input[type=checkbox] .class-of-checkbox { [INDENT]display: none;[/INDENT]
 }
/* OR */
#id-of-the-checkbox { [INDENT]display: none;[/INDENT]
 }
</style>

JS/jQuery


<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 [INDENT]if ( *** SOME CONDITION HERE *** ) {[/INDENT]
  [INDENT=2]$( '#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[/INDENT]
  [INDENT]}[/INDENT]
  }
</script>

indeed, it should ve been STYLE!