M
M
Mikhail Gilmutdinov2015-10-27 12:03:09
css
Mikhail Gilmutdinov, 2015-10-27 12:03:09

How to replace a piece of code with Jquery so that it always displays a certain text?

createDOM: function () {
            var nav = this;

            $('body')
                .append($('<div/>', {
                    'class': settings.cntClass
                }).append(nav.createNavDOM()))
                .append($('<div/>', {
                    'class': settings.panelClass
                })
                    .append($('<button/>', {
                        'class': settings.toggleClass
                    }).append($('<span/>')))
                    .append($('<h2/>', {
                        'class': settings.titleClass                        
                    }).append($('[data-type="rd-navbar-brand"]').length? $('[data-type="rd-navbar-brand"]').html() : document.title))
                    );
        }

.append($('[data-type="rd-navbar-brand"]').length? $('[data-type="rd-navbar-brand"]').html() : document.title))
This line does the conversion, but I need it to insert there not the length of this element, but the text, for example: 'Jquery'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Loginov, 2015-10-27
@Mixailhr

.apppend('ваш текст');
Or (if you edit the current one):
.append(text);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question