Get content of elements in other elements based on class element


ata field

Here is an example

<p id="myid">
    <font>
        <font>000</font>
    </font>
</p>

i want 000

I though

document.getElementById("#myid").innerHTML
Duchar
  1. #Not required to usegetElementById()
  2. You need to use innerTextinstead innerHTML.
  3. Make sure the code runs DOMafter loading is complete .

Code:

document.addEventListener("DOMContentLoaded", function() {
  alert(document.getElementById('myid').innerText);
});
<p id="myid">
  <font>
    <font>000</font>
  </font>
</p>

Related


Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I'm trying to do is remove all values that contain the word

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I'm trying to do is remove all values that contain the word

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I'm trying to do is remove all values that contain the word

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I'm trying to do is remove all values that contain the word

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I'm trying to do is remove all values that contain the word

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I'm trying to do is remove all values that contain the word

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I want to do is remove all values that contain the word "no

Get some list element indices based on other list elements

Pace I have two lists: a=['book','car','car','have'] b=['car','have'] I want this output: a_basedon_b_indexes=[1,2,3]# 'car' and 'have' indexes in list a I want a single line expression for this output. (I know how to use a for loop). Is this possible in pyt

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I want to do is remove all values that contain the word "no

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I want to do is remove all values that contain the word "no

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I want to do is remove all values that contain the word "no

Remove elements based on element content?

bad thing df.cleaned <- df[-which(str_detect(df, "Not found")),] "df" refers to a data frame consisting of multiple columns and rows. Many elements in this data frame have certain words in them. What I want to do is remove all values that contain the word "no

Remove elements based on the content of other elements

shadow I've done quite a few very jQuery scripts with slight modifications to suit my needs, but I've never written any scripts before at all. Now I find myself completely overwhelmed, so I'm really hoping someone can help me. I have the following script to cr