- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
A friend of mine needed to do this in order to show a “secret message” on his website. The idea is simple, a text would show up like “****” but you would se the real text when you select it. Sort of like when you use the same text color as in the background, but cooler.
You think this is possible to achieve with CSS? Or even with JS?
You could use a mouseover, not sure about selection…
http://api.jquery.com/select/ Although this is limited to input and textareas.
Thanks for the replies.
I had already looked at .select() and came up with this:
http://jsbin.com/eweti5
Works alright. Not exactly what I had in mind, but I guess it can be improved.
And this?
http://jsfiddle.net/ZWYSe/1/
Thanks for that, it’s another approach :)
Alright, I found this:
http://laboratorium.0xab.cd/jquery/fieldselection/0.2.3-test/test.html
And came up with something slightly better. It’s still kinda buggy but it’s incredibly closer to what I had in mind:
http://nahueljose.com.ar/ejemplos/jquery-ocultar-reemplazar-texto-seleccionado/
It works great when selecting from right to left, but it forces selection to the end of the string when doing it from left to right.
It works better if I update it on mouseup only, but that’s less fun :P