I'm using a Squarespace template and trying to change the search placeholder text (Type to search...).
I tried searching their forums and nothing has helped. I figure some simple jquery could do the trick, but I can't figure it out.
Here's the code:
<form id="yui_3_17_2_2_1421895144095_1398" _lpchecked="1">
<input placeholder="Type to search..." type="text"
spellcheck="false" value="" id="yui_3_17_2_2_1421895144095_1397">
</form>
Try this.
$("form").find("input").attr("placeholder", "Recherche");
Or place this just above the body
close tag
$(function () {
$("form").each(function () {
var inputElm = $(this).find("input");
var ph = inputElm.attr("placeholder")
if (ph && ph === "Type to search...") {
inputElm.attr("placeholder", "Recherche");
}
});
});
If you want YUI (natively supported by squarespace), try this.
Y.one('form').one('input').setAttribute('placeholder', 'Recherche');
Or
Y.all('form').each(function (node) {
var inputElm = node.one('input');
var ph = inputElm.getAttribute('placeholder');
if (ph && ph === "Type to search...") {
inputElm.setAttribute("placeholder", "Recherche");
}
});