Crossbrowser-input-placeholder

Created: 2012-03-21 02:34
Updated: 2015-02-05 13:53

README.md

Cross browser Input Placeholder

The way to keep it simple.

How?

you must have cip.js linked to your HTML document


<script type="text/javascript" src="cip.js"></script>

call CIP function passing de id


<input type="text" value="teste" id="teste">
<script type="text/javascript">
var teste = CIP("teste");
</script>

or the instantiated element


<input type="text" value="teste" id="teste">
<script type="text/javascript">
var inputEl = document.getElementById("teste");
var teste = CIP(inputEl);
</script>

you can pass an optional object parameter to use HTML5 placeholder in newer browsers (old browsers will work too, but with the CIP's magic)

var teste = CIP("teste", { useHTML5:true });

you can specify the document you want, passing it by the optional object parameter

var teste = CIP("teste", { useHTML5:true, doc: document });

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more