<script>var poiskaktive = true;</script>Затем ее состояние нужно проверить внутри события тэга button :

<button onclick="if(poiskaktive) DoSome();">Тык!</button>
DoSome = () => alert('DoSome')

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.