TYPO3: Can i use a Mask field into javascript code

128 Views Asked by At

Can I use a TYPO3 Mask checkbox field into my javascript code, in fact I have a slider item and I want to add a checkbox for autoplay (on/off) in the backend of TYPO3, then the editor can use it.

          swipe: true,
          swipeToSlide: true,
          adaptiveHeight: true,
          touchThreshold: 10,
            autoplay: true,   <-----------
          autoplaySpeed: 3000,
        });

the mask screenshot

1

There are 1 best solutions below

0
On

In order to pass content element data to JavaScript, I suggest the data-pattern:

Fluid:

<... data-slider-autoplay="{data.tx_mask_autoplay}">

JavaScript:

document.querySelector['[data-slider-autoplay]'].dataset.sliderAutoplay