K
K
Kensorin2017-11-17 18:02:02
JavaScript
Kensorin, 2017-11-17 18:02:02

How to bind the Bitrix24 CRM form to an existing button on the site?

Existing button:

jQuery(function($) {
       var myButton = '<a href="http://example.org" class="roll-button button-slider">My Button</a>';
       $( '.slide-inner' ).append(myButton);
});

It is necessary to insert, so that the button remains in the slider:
<script id="bx24_form_button" data-skip-moving="true">
        (function(w,d,u,b){w['Bitrix24FormObject']=b;w[b] = w[b] || function(){arguments[0].ref=u;
                (w[b].forms=w[b].forms||[]).push(arguments[0])};
                if(w[b]['forms']) return;
                s=d.createElement('script');r=1*new Date();s.async=1;s.src=u+'?'+r;
                h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(s,h);
        })(window,document,'https://crsystems.bitrix24.ua/bitrix/js/crm/form_loader.js','b24form');

        b24form({"id":"6","lang":"ru","sec":"pa1cic","type":"button","click":""});
</script>
<button class="b24-web-form-popup-btn-6">Мы перезвоним вам</button>

Help plz. I do not understand how to combine these codes correctly ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Eskov, 2019-03-12
@taurus2790

Just add the same class to your button

jQuery(function($) {
       var myButton = '<a href="http://example.org" class="roll-button button-slider b24-web-form-popup-btn-6">My Button</a>';
       $( '.slide-inner' ).append(myButton);
});

S
Sergey, 2020-04-04
@sergafon

When creating a form, you need to choose to open the form on click, then Bitrix will generate a code, in your case, this class ".b24-web-form-popup-btn-6" is responsible for opening the desired form

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question