Single field with default options.
<input type="text" name="name" class="tb-name" placeholder="Name" data-ph-image="images/person.png">
$(document).ready(function() {
$('input.tb-name').phImage();
});
Note: The background-position CSS property has been set within the CSS for this field.
Multiple fields with default options, images include text.
<div class="fields">
<input type="text" name="name" class="tb-name" placeholder="Name" data-ph-image="images/person-text.png">
<input type="email" name="email" class="tb-email" placeholder="Email" data-ph-image="images/mail-text.png">
<input type="text" name="phone" class="tb-phone" placeholder="Phone" data-ph-image="images/phone-text.png">
<textarea name="msg" class="ta-msg" placeholder="Message" data-ph-image="images/pencil-text.png"></textarea>
</div>
$('.fields input, .fields textarea').phImage();
Note: The background-position CSS property has been set within the CSS for these fields.
Multiple fields whilst keeping placeholder text and passing options in, images don't contain the text. Note that this functionality can be accomplished with plain CSS as well.
<div class="fields">
<input type="text" name="name" class="tb-name" placeholder="Name" data-ph-image="images/person.png">
<input type="email" name="email" class="tb-email" placeholder="Email" data-ph-image="images/mail.png">
<input type="text" name="phone" class="tb-phone" placeholder="Phone" data-ph-image="images/phone.png">
<textarea name="msg" class="ta-msg" placeholder="Message" data-ph-image="images/pencil.png"></textarea>
</div>
$('.fields input, .fields textarea').phImage({
remove_current: false,
padding: '0 0 0 40px'
});
Note: The background-position CSS property has been set within the CSS for these fields.