5
Answers

placeholder not working in ie9?how to fix it

Raja

Raja

8y
212
1
<label>Text:   
<span style="position: relative;">
<input id="placeholder1314588474481" name="text" maxLength="6" type="text" placeholder="Hi Mom">
 <label style="font: 0.75em/normal sans-serif; left: 5px; top: 3px; width: 147px; height: 15px; color: #bababa; position: absolute; overflow-x: hidden; font-size-adjust: none; font-stretch: normal;" for="placeholder1314588474481">Hi Mom</label> </span> </label>
i have also used some jquery.
 
How to set place holder without any script or query in ie9.
Answers (5)
0
Raja

Raja

NA 1.7k 45.3k 8y
Thank You :)
0
Vinay Singh

Vinay Singh

NA 5.9k 126.1k 8y

You could use this jQuery plugin: https://github.com/mathiasbynens/jquery-placeholder

But your link seems to be also a good solution.

0
Midhun T P

Midhun T P

NA 19.7k 281.1k 8y
Hi,
Please don't just copy paste the code from here, as it had lost spaces when formatted.
Please check putting this -
<!-- IF IE - use Placeholder Fallback -->
<!--[if lt IE 10 ]>
<script>
$(document).ready(function () {
$("body").find('[placeholder]').each(function () {
$(this).val($(this).attr('placeholder'));
$(this).focus(function () {
if ($(this).attr('placeholder') == $(this).val()) {
$(this).val('');
}
});
});
});
</script>
<![endif]-->
0
Raja

Raja

NA 1.7k 45.3k 8y
Hi,
This script is not working in ie9.
0
Midhun T P

Midhun T P

NA 19.7k 281.1k 8y
Hi,
Check this -
  1. <!--IFIE-usePlaceholderFallback-->
  2. <!--[ifltIE10]>
  3. <script>
  4. $(document).ready(function(){
  5. $("body").find('[placeholder]').each(function(){
  6. $(this).val($(this).attr('placeholder'));
  7. $(this).focus(function(){
  8. if($(this).attr('placeholder')==$(this).val()){
  9. $(this).val('');
  10. }
  11. });
  12. });
  13. });
  14. </script>
  15. <![endif]-->