Hello,
I’m hoping to override and add functionality to limit the number of characters in an input field. There are two other recent posts where a similar question was asked:
They suggest using either a PATTERN or MAXLENGTH attribute on the input field. How does the syntax look to add an attribute?
A little background info first. My call to Snipcart is as follows:
<script>
window.SnipcartSettings = {
publicApiKey: "...shh, I'm not telling you",
loadStrategy: "on-user-interaction",
modalStyle: "side",
templatesUrl: "/snipcart-templates.html",
},
function () { (g = yadda yadda yadda...
</script>
I load the template URL fine. I know this because using the example from documentation (see below), it overrides as expected:
<div id="snipcart-templates">
<item-line>
<div class="root">
<h2>Custom Override Test</h2>
<div>This is my overridden template. Wahoo!, it worked</div>
</div>
</item-line>
</div>
Where I’m struggling is understanding the syntax to add an attribute to <snipcart-input>
. This is the template override markup I’m currently trying with no success:
<div id="snipcart-templates">
<snipcart-input>
<div class="root">
<input type="<string>" name="<string>" placeholder="<string>" icon="<string>" maxlength="25">
</div>
</snipcart-input>
</div>
I feel like I’m missing a basic concept here. Can anyone point me in the right direction?