Patrick Guinness
Patrick Guinness

Reputation: 397

using javascript to hide input if user doesn't have javascript enabled - anyway to stop it flashing up quickly on page load?

I have a jquery range slider which, in case people have javascript disabled, needs to be two text inputs instead. So I use javascript to hide the inputs, so that if JavaScript is disabled then the inputs will be there for my non-JavaScript users.

So when the page loads the inputs appear just for a fraction of a second before the javascript kicks in and hides them. This is a little annoying but not a huge problem I suppose. Just wondering if anyone has a better way of doing this? Thanks

Upvotes: 0

Views: 103

Answers (1)

Mike Brant
Mike Brant

Reputation: 71414

Yes, put the input fields inside a noscript tag (or alternative, non-hidden-by-css versions in noscript tag)

i.e.

<script>
// Output your base slider html via javascripthere
</script>
<noscript>
<!-- Your plain HTML fields here -->
</noscript>

Upvotes: 3

Related Questions