Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to change Span text with Javascript?

I am trying to change text using javascript, but I can’t target this element no matter what…

<div class="elementor-element elementor-element-2d85236 elementor-widget elementor-widget-text-editor" data-id="2d85236" data-element_type="widget" id="is_connected" data-settings="{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}" data-widget_type="text-editor.default">
            <div class="elementor-widget-container">
                <div class="elementor-text-editor elementor-clearfix"><p style="text-align: center;"><span style="color: #ff0000;">Not Connected</span></p></div>
            </div>
            </div>

I want to change this "Not Connected" to "Connected"
I tried with this, but it doesn’t work:

var AddressText = $("#connect").html(address.substr(0, 13) + "...")
    var elems = document.getElementsByClassName(elementor-element elementor-element-2d85236 elementor-widget elementor-widget-text-editor)[0].innerText;
    elems = "Connected"

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Wrap the selector inside '

document.getElementsByClassName('elementor-element elementor-element-2d85236 elementor-widget elementor-widget-text-editor')[0].innerText = 'connected'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading