Thanks JD, have tried the above and luck, still getting the same error message (see screengrab below). I’ve done this on multiple different elements on the page from text boxes to containers to buttons and all have the same issue.
The blur() method only exists in inputs elements. The error is quite clear, a Text element does not have a method that blurs, as boxes, containers and buttons, because there is no need to blur from an element that is not an input.
That makes sense now Bruno - thank you. If i wanted to blur the text on a text element so that if you’re not logged in you can’t see certain elements - how would I go about doing that?
const bulrText = ($element, blurry, tag = 'p') => {
$element.html = blurry ? `<${tag} style="color: transparent;text-shadow: 0 0 5px rgba(0,0,0,0.5);">${$element.text}</${tag}>` : `<${tag}>${$element.text}</${tag}>`;
}
$w.onReady(() => {
//when you wish to make it blurry, for example here or inside a button click event handler:
bulrText($w('#text1'), true, 'p');//or h1, h2 etc.. instead of p if you want it to be a title and not a paragraph.
//when you wish to cancel the blurry effect:
bulrText($w('#text1'), false, 'p');
})
@gilesgun123 You’re welcome.
And if you want the blurred text to be unselected (so the user want be able to select it and copy-pate it. You can do the following:
For text element on page - put a transparent shape over it.
For text in the iframe, set it in the style. like this: