0

Edited for tags and further explanation of the question

Hello ,i am fairly new to the web programming, sorry in advance if this sounds out of place. My question is, i need to get customer's name and number from this <span class="tag-element-content" title="${Customer No}">${Customer Name}-${Customer No}</span> area, which is inside the code below, any help would be very appreciated.

<div class="tagger" id="ChoosenCustomer">
                                        <div class="tags-container tag-view focused" id="branches">
                                            <div class="tag-element-container" dojoattachpoint="_tagsContainer">
                                                <div class="tag-decorated-element" name="ChoosenTags" id="" is-clicked="true">
                                                    <span class="tag-element-content" title="${Customer No}">${Customer Name}-${Customer No}</span>
                                                    <span id="RemoveCustomer" class="tag-element-delete icon-cross" search-id="" click=DeleteCustomer()></span>
                                                    <input type="hidden" id="" value="${Customer No}" is-clicked="true">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
2

3 Answers 3

1

try this:

let span_text = document.querySelector('.your-element-class').textContent;

with jQuery:

let span_text = $('.your-element-class').text();
Sign up to request clarification or add additional context in comments.

Comments

0

in your case:

document.getElementById("anid").innerText;

and add the id to your element

1 Comment

"and add the id to your element" - Why? There are ways that don't require to change the markup...
0

Simply you can use jquery on your project and :

var SpanText = $('.tag-element-content').text();

1 Comment

"Use this code" - Why? How is a collection of HTMLElements useful?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.