صفحه‌ای که درخواست کرده‌اید، درحال حاضر به زبان شما در دسترس نیست. می‌توانید با استفاده از قابلیت ترجمه داخلی Google Chrome، فوراً هر صفحه وبی را به زبان موردنظرتان ترجمه نمایید.
/tagmanager/community?hl=en
This content is likely not relevant anymore. Try searching or browse recent questions.
Wie kann ich ein Geschwister Element auslesen?
0
Hallo, wie kann ich ein Geschwister Element des selben DOM Baums auslesen, in dem ich gerade klicke? Ich habe auf der Seite mehrere Teaser mit Teammitgliedern, und wenn ich auf die Tel.-Nr. einer der Personen klicke möchte ich den Namen ausgegeben haben. 
Der Name steht unter span.name und die Tel wird mit <a href="tel:01234...> im Geschwister Element div.data.phone ausgegeben. Das Eltern Element von den beiden ist div.contact-person-data und vom ganzen Teaser article.node.contact-person.teaser
Mit der Variable "DOM-Element" und dem CSS-Selektor span.name wird mir immer der 1. Name ausgegeben, da es das 1. span.name auf der Seite ist, auch wenn ich in den 2. oder 3. oder letzten Teaser klicke. 
Wie muss mein Element-Selektor aussehen, damit mir der Name der Person ausgegeben wird, wo ich auf die Tel-Nr geklickt habe? Oder gibt es eine Funktion das richtige span.name auszulesen? 
Vielen Dank für Eure Hilfe im Voraus.
Details
Pinned
Locked
Latest Update Latest Updates (0)
Relevant Answer Relevant Answers (0)
All Replies (1)
Relevant Answer
Hallo, denke du musst dir eine benutzerdefinierte JavaScript Variable erstellen.
So eine funktion sieht dann wie folgt aus.

function(){

var element = {{Click Element}};
var parent = element.parentElement;
var gettext = "";
for(i=0;i<parent.children.length;i++){
if(parent.children[i].getAttribute("class") == 'name'){
gettext = parent.children[i].textContent;
break;
}
}
return gettext;

}

Diese sollte dir den text zurückgeben.
Wenn du den html Teil als code postest von div.contact-person-data ist es einfacher einen kurzes script zu schreiben.
marked this as an answer
This question is locked and replying has been disabled.
Discard post? You will lose what you have written so far.
Write a reply
10 characters required
Failed to attach file, click here to try again.
Discard post?
You will lose what you have written so far.
Personal information found

We found the following personal information in your message:

This information will be visible to anyone who visits or subscribes to notifications for this post. Are you sure you want to continue?

A problem occurred. Please try again.
Create Reply
Edit Reply
This will remove the reply from the Answers section.
Notifications are off
Your notifications are currently off and you won't receive subscription updates. To turn them on, go to Notifications preferences on your Profile page.
Report abuse
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.

Go to the Legal Help page to request content changes for legal reasons.

Reported post for abuse
Unable to send report.
Report post
What type of post are you reporting?
Google takes abuse of its services very seriously. We're committed to dealing with such abuse according to the laws in your country of residence. When you submit a report, we'll investigate it and take the appropriate action. We'll get back to you only if we require additional details or have more information to share.

Go to the Legal Help page to request content changes for legal reasons.

Reported post for abuse
Unable to send report.
This reply is no longer available.
/tagmanager/threads
//accounts.google.com/ServiceLogin
You'll receive email notifications for new posts at
Unable to delete question.
Unable to update vote.
Unable to update subscription.
You have been unsubscribed
Deleted
Unable to delete reply.
Removed from Answers
Removed from Updates
Marked as Recommended Answer
Marked as Update
Removed recommendation
Undo
Unable to update reply.
Unable to update vote.
Thank you. Your response was recorded.
Unable to undo vote.
Thank you. This reply will now display in the answers section.
Link copied
Locked
Unlocked
Unable to lock
Unable to unlock
Pinned
Unpinned
Unable to pin
Unable to unpin
Marked
Unmarked
Unable to mark
Reported as off topic
Known Issue
Fixed
Marked Fixed
Unmarked Fixed
Unable to mark fixed
Unable to unmark fixed
/profile/0
false
جستجو
پاک کردن جستجو
بستن جستجو
برنامه‌های Google
منوی اصلی
Search Help Center
true
102259
false