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 7863575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:31:40+00:00 2026-06-02T23:31:40+00:00

In the HTML below, I need to retrieve the p_id attribute based on the

  • 0

In the HTML below, I need to retrieve the p_id attribute based on the p_code attribute.
For example:

If I have p_code of “WH15”, I need “63” returned.

how would I do that using jQuery?

<div id="deslist_13" class="sch_accordion_item_content_active" style="display: block;">
    <div class="left_shadow"></div>
    <div p_code="BRE" id="pdiv_60" p_id="60" class="program odd">
      <input type="hidden" id="hidden_60" value="BRE">
      <input type="hidden" id="tabId_60" value="13">
      <div class="cb"></div><span>BRE</span>
    </div>
    <div p_code="WH13" id="pdiv_61" p_id="61" class="program">
      <input type="hidden" id="hidden_61" value="WH13">
      <input type="hidden" id="tabId_61" value="13">
      <div class="cb"></div><span>WH13</span>
    </div>
    <div p_code="WH14" id="pdiv_62" p_id="62" class="program odd">
      <input type="hidden" id="hidden_62" value="WH14">
      <input type="hidden" id="tabId_62" value="13">
      <div class="cb"></div><span>WH14</span>
    </div>
    <div p_code="WH15" id="pdiv_63" p_id="63" class="program">
      <input type="hidden" id="hidden_63" value="WH15">
      <input type="hidden" id="tabId_63" value="13">
      <div class="cb"></div><span>WH15</span>
    </div>
    <div p_code="BPA" id="pdiv_64" p_id="64" class="program odd">
      <input type="hidden" id="hidden_64" value="BPA">
      <input type="hidden" id="tabId_64" value="13">
      <div class="cb"></div><span>BPA</span>
    </div>
    <div p_code="BPR" id="pdiv_65" p_id="65" class="program">
      <input type="hidden" id="hidden_65" value="BPR">
      <input type="hidden" id="tabId_65" value="13">
      <div class="cb"></div><span>BPR</span>
    </div>
</div>
  • 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-02T23:31:42+00:00Added an answer on June 2, 2026 at 11:31 pm
    var p_id = $('div[p_code="WH15"]').attr('p_id');
    

    Demo: http://jsfiddle.net/mattball/9Htdq/


    However: it would be far better to use HTML5 data-* attributes if you can alter the markup. They are allowed by the HTML5 spec, and work automagically with .data().

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

Sidebar

Related Questions

htmlparser.Parser, I have the snippet of html(see below) and i need to get the
I have got html as below <a href= data-href=/somefile.php?id=10&refcode=/test.php>Hello</a> and I need to replace
Given the HTML below, I need a jQuery selector that selects the <option> with
I have an HTML table with input elements that I am using for batch
I have a form with the following HTML below: <form id=course_edit_form name=course_form action=/courses/save method=post>
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have below html code in one of the opensource project. <form action=/wiki/bin/view/Main/Search> <div
I have the html below: <span class=srch-URL> <a id=CSR_U_2 href=http://www.test.com/TestForm.aspx>http://www.test.com/TestForm.aspx</a> </span> I am trying
I need to retrieve some data from a web page. After analysing the HTML
To dynamically fill DropDown controls on my HTML Form, I have written code that

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.