Normally we set a placeholder in textbox only text. Just like in textbox
when we input any key(keypress through keyboard) placeholder will had disappear and blank textbox.
Now we include placeholder image in textbox (Text + Image).
In HTML5 we used placeholder easily just tag property
placeholder = ‘ Your Placeholder Name ‘
Code | Output |
<input type=’text’ placeholder=’First Name’ id=’p1′> |
- with_test.css
.placeImage {background-image:url=’Your image url’no-repeat;}
- with_test.js
<script src=”jquery.js”></script>
<script>
i=0;
$(document).ready(function(){
$(“input”).keypress(function(){
$(“input #p1”).css({background-image:none});
}).blur(function() {
if($(“input #p1”).val() == ‘ ‘){
$(this).css({background-image:url=’Your image url’no-repeat;})
}
}).blur();
});
</script>
Some simple placeholder Service
Leave a comment