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

  • Home
  • SEARCH
  • 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 157495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:30:52+00:00 2026-05-11T10:30:52+00:00

I have a problem in my code. I want to get the b tag

  • 0

I have a problem in my code. I want to get the b tag that has the style color silver using Javascript. I tried using the tagName === ‘B’ but it didn’t work. I figured that the B tags are not children of the rowData class.

  <tr class='rowData'>     <td style='padding: 0pt;'>                 <table><tr>                 <td>                     <b style='font-size: 15px; color: silver;'>Mugging</b>                     <br />Payout: <b style='color: green;'>$200 - $300</b>                     <br />Experience: +1                                    </td>                  <td style='text-align: right;'>                                     </td>             </tr></table>         </td>         <td style='padding: 0pt;'>             <table><tr>                 <td style='width: 100px;'>                     <b style='color: gray;'>Required:</b>                      <br />Energy:&nbsp;1                                    </td>                 <td style=''>                                     </td>             </tr></table>         </td>          </td>   </tr> 

I removed some part of it..

Here’s some part of the Javascript code:

var jobs = {};  jobs.scan = function() {     var tagHolder = {};     var availJobs = {};     var jobContents = dom.get('app8743457343_content');     var rData = dom.getElementsByClass('rowData', jobContents, 'tr');     for(var i = 0; i < rData.length; i++) {         var rChildren = rData[i].childNodes;         for(var j=0; j<rChildren.length; j++) {             if(rChildren[j].tagName === 'B') {                 alert(rChildren[j]);             }         }     } }  jobs.scan(); 

When I started the script it didn’t alert, or responded. Maybe I need to use something to like nextSibling? Please help me figure this out.. I want the b with the style color silver. The Mugging text

  • 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. 2026-05-11T10:30:52+00:00Added an answer on May 11, 2026 at 10:30 am

    You could fight the good fight and try to get that monstrosity working across all browsers….

    Or, you could try jQuery! It’s fun and easy, and all the cool kids are doing it!

    var text = $('tr.rowData').find('b').filter(function() {     return $(this).css('color') == 'silver'; }).text(); alert(text); 

    Tada!

    EDIT: In all seriousness, if you want to do it in raw javascript, this works for me on IE and Firefox:

    var text; var bs = document.getElementsByTagName('b'); for(var x = 0; x < bs.length; x++) {     if(bs[x].style.color == 'silver') {         text = bs[x].innerHTML;         break;     } } alert(text); 

    It is just grabbing all the bold elements in the document and checking to see which one has a color of silver. This is not super efficient, obviously, and I am not sure of your use case. I do see in your code you are first grabbing a reference to a jobContents element. I am not sure where that is coming from as you didn’t post that part of the markup, but if the <b> will end up being inside this element, you can change this line:

    var bs = document.getElementsByTagName('b'); 

    To this:

    var bs = jobContents.getElementsByTagName('b'); 

    Which will then 1) speed it up, 2) make sure you get what you want.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 93k
  • Answers 93k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do this: #define DEFAULT_SIZE 10 The = sign is not… May 11, 2026 at 6:34 pm
  • Editorial Team
    Editorial Team added an answer Format with Currency format string =Format(Fields!Price.Value, "C") It will give… May 11, 2026 at 6:34 pm
  • Editorial Team
    Editorial Team added an answer Well this one is interesting. I'm assuming that Blog.BlogEntries is… May 11, 2026 at 6:34 pm

Related Questions

I have a DateTime object that I need to print in a custom gridlike
Some background info; LanguageResource is the base class LanguageTranslatorResource and LanguageEditorResource inherit from LanguageResource
I have a very bad feeling about using lock in my code but now
I’m having a little Architecture problem. In my project I have a Business Logic

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.