Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #788771

    Hi,

    I create another thread because old thread is closed:
    https://kriesi.at/support/topic/custom-id-for-layout-elements/

    I have a solution for that:

    (function ($) {
        'use strict';
    
        $(document).ready(function () {
            
            // set id
            (function () {
    
                // console.log($('div[class*="js-set-id--"]'));
                $('div[class*="js-set-id--"]').each(function () {
                    var $this = $(this);
                    var id = false;
    
                    var classes = $this.attr('class').split(' ');
                    for (var i = 0; i < classes.length; i++) {
                        var matches = /^js-set-id--(.+)/.exec(classes[i]);
                        if (matches != null) {
                            id = matches[1];
                            break;
                        }
                    }
    
                    if (id) {
                        $this.attr('id', id);
                    }
                });
    
            })();
    
        });,
    
    })(jQuery);

    If you add js-set-id--element-id class to an element then that element has id element-id.

    I hope it helps,
    thanks.

    • This topic was modified 7 years, 7 months ago by hayatbiralem. Reason: Cosmetic updates
    #788871

    Hey hayatbiralem,
    Thank you for sharing, I have added Tags to help with searching.

    Best regards,
    Mike

    #789064

    Thanks :)

    #789068

    Hi hayatbiralem,

    Thank you so much for sharing! I’m sure it can help others. I’ll close this thread now.

    For your information,  if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/

    Cheers!
    Sarah

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Custom ID for Layout Elements (continue)’ is closed to new replies.