Answer the question
In order to leave comments, you need to log in
Why can't my js file be connected?
I added the code in the site template ( /local/templates/main/header.php )
Asset::getInstance()->addJs("/bitrix/js/jquery.mask.min.js");
$(document).ready(function() {
...
$('.address_zip').mask('999999');
...
}
Uncaught TypeError: $(...).mask is not a function
<head>
<meta charset="UTF-8"/>
<title><? $APPLICATION->ShowTitle() ?></title>
<? $APPLICATION->ShowHead() ?>
<?
global $currPage, $isMainPage;
$currPage = $APPLICATION->GetCurPage(false);
$isMainPage = ($currPage == "/" ? true : false);
Asset::getInstance()->addString('<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />');
Asset::getInstance()->addString('<meta http-equiv="X-UA-Compatible" content="IE=Edge, chrome=1" />');
Asset::getInstance()->addCss("https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css");
Asset::getInstance()->addCss("https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic");
Asset::getInstance()->addJs("https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js");
Asset::getInstance()->addCss("/slick.css");
Asset::getInstance()->addJs("//cdn.jsdelivr.net/gh/kenwheeler/[email protected]/slick/slick.min.js");
Asset::getInstance()->addCss("https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.formstyler.min.css");
Asset::getInstance()->addJs("https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.formstyler.min.js");
Asset::getInstance()->addCss("/style.css");
Asset::getInstance()->addJs("/scripts.js");
Asset::getInstance()->addJs("/main.js");
Asset::getInstance()->addJs("/bitrix/js/jquery.mask.min.js");
Asset::getInstance()->addString('<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js" data-skip-moving="true"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js" data-skip-moving="true"></script>
<![endif]-->');
?>
</head>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question