Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7904783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:13:57+00:00 2026-06-03T10:13:57+00:00

For the following code: <div myLable=a><p><span style=color:#00aaFF>change me only 1</span></p></div> <div myLable=b><span style=color:#00aaFF>change me

  • 0

For the following code:

<div myLable="a"><p><span style="color:#00aaFF">change me only 1</span></p></div>
<div myLable="b"><span style="color:#00aaFF">change me only 2</span></div>

If I use

$('div[myLable="a"]').text("change");
$('div[myLable="b"]').text("change");

Then all the html code inside will be change, it was not what I need.

Note that there are two pre-condition:

  1. No any label or id in the child element.
  2. We’ve no idea how deep the child element in, what can conclude is that the requirement is to change the most deepest child element’s text.
  3. It will be good if using raw javascript in solution, but must use the $('div[myLable="a"]') form because the parent element has no id but only a user-define label, so I need this Jquery form.

How can I change the text only in this case?

Thanks in advance,

Wa

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T10:14:00+00:00Added an answer on June 3, 2026 at 10:14 am

    You need to change the text inside of span. So use apropriate selector which point to span:

    $('div[myLable="a"] span').text("change");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code : <div id=wrapper> <div style=width:500px;background-color:yellow;> // this is a
I have the following code: <div> <div onmouseover=this.style.color='red' onmouseout=this.style.color='blue' style=float:left> a <br/> b <br/>
Gday All, The following code displays a div based on the option that has
I currently use the following code to position a div directly below an input
I have the following code in my file to load a div with HTML
if have the following code: <div id=container style=position:relative; width:300px; height:300px; overflow:scroll;> <div id=header> </div>
I have the following code <div class=framepage> <header> <script type=text/javascript> function getBaseUrl() { return
I have the following HTML code inside a div: <a href=http://www.mysql.com> <img src=images/php-power-micro2.png alt=Image
I have the following code: DIV><TABLE><TBODY><TR><TD> <DIV id=namesClass style=WIDTH: 700px> <UL style=MARGIN-LEFT: 0px! important;
I use the following code on my page: <div id=itemstable class=item_type1> ...other divs here...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.