-
AuthorPosts
-
July 22, 2020 at 1:53 pm #1232246
Kriesi’s Friends
I am using Google Tag Manager to measure my page interactions and I need to create a unique id for each button inside the ROW OF BUTTONS container.Currently it lets me create an id just for the container and not independently.
Could you help me?
Thank you very much!July 22, 2020 at 7:52 pm #1232373Hey mtmundarain,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaJuly 22, 2020 at 10:16 pm #1232430Attached
July 23, 2020 at 3:50 pm #1232630Hi mtmundarain,
Yes, you add one id and we can help you with the selectors for the individual buttons.
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaJuly 23, 2020 at 4:29 pm #1232647Victoria
Thank you so much
I have the same situation in various containers around the entire siteJuly 23, 2020 at 5:49 pm #1232711Hi mtmundarain,
This is the selector for the first button .avia-buttonrow-wrap .avia-button:first-of-type
This is the selector for the second .avia-buttonrow-wrap .avia-button:nth-of-type(2)
Best regards,
VictoriaJuly 23, 2020 at 6:17 pm #1232730Victoria, thank you very much
It seems to me that I am not understanding. SorryI have many rows of double buttons all over the site:
1.- Selector and ID is the same?
1.-Can I create an ID for each button as in the rest of the enfold elements?
2.-If I create a third button in the same row, what would be the selector?I need a little more context
Thank you!July 24, 2020 at 12:19 pm #1232954July 24, 2020 at 2:00 pm #1232985give to your button-row element a unique ID
put this to child-theme functions.phpfunction id_to_button_row_buttons(){ ?> <script> (function($) { var ButtonRowID = $('.avia-buttonrow-wrap').attr('id'); $('#'+ButtonRowID+' .avia-button').each(function(i) { $(this).attr('id', ButtonRowID+'-button'+(i+1)); }); })(jQuery); </script> <?php } add_action( 'wp_footer', 'id_to_button_row_buttons');
it will make the ID’s to your buttons as #ID-button1, #ID-button2, #ID-button3 etc the ID is the id you put on the button-row
see here: https://webers-testseite.de/buttonrow/
July 24, 2020 at 2:33 pm #1232999Great!
It’s exactly what I was looking for!
This forum is tops.
Thank you both very much!July 24, 2020 at 8:50 pm #1233083Hi mtmundarain,
Glad you got it working for you with Guenni007’s help! :)
If you need further assistance please let us know.
Best regards,
VictoriaAugust 28, 2020 at 10:30 am #1241510for more than one button row on the site:
function id_to_button_row_buttons(){ ?> <script> (function($) { $('.avia-buttonrow-wrap').each(function(){ var that = this; $('.avia-button', this).each(function(i){ var ButtonRowID = $(that).attr('id'); $(this).attr('id', ButtonRowID+'-button'+(i+1)); }); }); })(jQuery); </script> <?php } add_action( 'wp_footer', 'id_to_button_row_buttons');
see here: https://webers-testseite.de/buttonrow/
-
AuthorPosts
- You must be logged in to reply to this topic.