placeholder can be used with input fields, nothing wrong with that
but for example when I click in the field the placeholder text only disappears when I start writing. How to make it disappear when I hover over it.
Placeholder doubt
-
- Posts: 205
- Joined: Mon Jul 09, 2012 11:13 pm
Re: Placeholder doubt
If you mean when clicked, try:
<input type="text" placeholder="Enter Message..." onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Message...'" />If you really mean hover, try:
<input type="text" placeholder="Enter Message..." onmouseover="this.placeholder = ''" onmouseout="this.placeholder = 'Enter Message...'" />
<?php while(!$succeed = try()); ?>
Re: Placeholder doubt
Moved to HTML section.
Question to ExtremeGaming; would I be able to use that, but with value?
Because IE simply refuses to use PlaceHolder.
Question to ExtremeGaming; would I be able to use that, but with value?
Because IE simply refuses to use PlaceHolder.
Re: Placeholder doubt
Extremegaming that would make it disappear when I click on the field to start writing righr?
-
- Posts: 205
- Joined: Mon Jul 09, 2012 11:13 pm
Re: Placeholder doubt
Yes just change this.placeholder to this.valueHelx wrote: Question to ExtremeGaming; would I be able to use that, but with value?
Because IE simply refuses to use PlaceHolder.
However, you will need to remove the onblur because it will submit whatever you are setting the default value to, regardless of what you enter.
Yes once you click on the input field it will disappear.Fidbeck wrote: Extremegaming that would make it disappear when I click on the field to start writing righr?
<?php while(!$succeed = try()); ?>
Re: Placeholder doubt
The normal way to do this is with a bit of JavaScript.
var input = document.getElementById('the_id'); input.addEventListener('focus', function(event){ if (this.value == ''){ this.value = 'Enter Message...'; } }); input.addEventListener('blur', function(event){ if (this.value = 'Enter Message...'){ this.value = ''; } });
-
- Posts: 205
- Joined: Mon Jul 09, 2012 11:13 pm
Re: Placeholder doubt
And in case the user has javascript disabled you can always put it in a <noscript>
<?php while(!$succeed = try()); ?>
Re: Placeholder doubt
@ExtremeGaming
Even though I said click and hover I meant click
@Jacek
Your suggestion worked out too but ExtremeGaming's one is a bit more condensed.
Thanks for the answers
Even though I said click and hover I meant click
@Jacek
Your suggestion worked out too but ExtremeGaming's one is a bit more condensed.
Thanks for the answers
Re: Placeholder doubt
The onAction attributes are no longer valid HTMLFidbeck wrote:@Jacek
Your suggestion worked out too but ExtremeGaming's one is a bit more condensed.
Re: Placeholder doubt
I'm not using onAction, i'm using onfocus and onblur kidding
itsnot? :S
Then I guess I have to change it :S
itsnot? :S
Then I guess I have to change it :S