I
I
IDigle12020-01-24 15:06:27
JavaScript
IDigle1, 2020-01-24 15:06:27

Express + Handlebars. How to connect header and footer?

How to connect the header and footer to the body in hbs in the same way as, for example, it can be done in php:
<? include('header.php') ?>
// some html
<? include('footer.php') ?>
Or maybe hbs has its own principles that should be used?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Fedorov, 2019-04-23
@ivanmorda

<script src="https://yandex.st/jquery/2.1.1/jquery.min.js"></script>

Move to the end of body
And include the .js file where you write the code
var coins = 0; tap = 1;
if(coins == 40 & tap == 1) {
    tap+=1;
} else if(coins == 140 & tap == 2) {
    tap+=1; 
}
$("#click").click(function() {
    $("#coins").append(coins);
    $("#tap").append(tap);
});

For example:
<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title> 
    </head>
    <body>
        <button class="popup-open" href="#">Магазин</button> 
        <div class="popup-fade"> 
        <div class="popup"> 
        <a class="popup-close" href="#">Закрыть</a> 
        <p id='window'><center>Цены</center></br>1 - 3 тапа за 200 коинов</br>2 - 10 тапов за 4000 коинов</br>3 - 30 тапов за 17000 коинов</br>4 - 70 тапов за 30000 коинов</br><input id='input' placeholder='Введите номер товара...'></input> <button id='btn'>Купить</button></p> 
        </div> 
        </div>
        <p id='coins'>Коинов: </p>
        <p id='tap'>Тапов: </p>
        <button id='click'>Кликать</button>
        <script src="https://yandex.st/jquery/2.1.1/jquery.min.js"></script>
        <script src="js/main.js"></script>
    </body>
</html>

And in the js/ main.js file, write your code already.

D
Dmitry Belyaev, 2020-01-24
@IDigle1

https://handlebarsjs.com/guide/partials.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question