Creating an input mask, or phone # validation

Continuing the discussion from Is it possible to create an input mask for a phone number?:

The way it was done with one of my other sites, there was a js lines:

$(function(){
	
	$("input[name='phone']").mask("+7(999) 999-99-99");
	
	$('input[placeholder], textarea[placeholder]').placeholder();
});

So I tried this in my webflow project. In the full site package, in js folder there are 2 files modernizr.js and webflow.js. I tried adding these js lines in both files and also created a separate scripts.js. None of them worked in my forms.

So, are there any tips on that?
Where do I put jawa scripts if I need to?
Can I add a custom js code at all in webflow projects?

Usually the recommended method to place jQuery code is in Page Settings > Footer Code, as you need jQuery to load before your custom script.

Thank you for help, but this didn’t work (

You also need to wrap code in the “Footer Code” section with

<script>

</script>

Also, it seems like your other sites are using external jQuery plugins, which you need to import as well.

Specifically .mask() and .placeholder() functions.

Oh, this sounds a bit more complicated than I thought… ) So Webflow doesn’t have built in means for that sort of stuff?

That is what the Custom Code field is there for - to allow web developers to implement such functionality.

Ok, thank you, I will try to sort this out

This topic was automatically closed after 60 days. New replies are no longer allowed.