Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Get value of data attribut in Jquery

In my page i've got this :

<input type="hidden" class="fieldBasicData" data-name="adminvtech_tks_devis" data-type="string" data-displayvalue="181" data-value="181">

With Jquery I need to get the data-value (181 in this case) by searching by data-name (adminvtech_tks_devis in this case) in my HTML page.

How can I do that ?

I've tried this without success :

alert( $('*[data-name="adminvtech_tks_devis"]' ).data("data-value") );

But i'm getting undefined in my alert box instead of 181.

Thanks you very much.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to omit the data- part in the key name:

alert( $('*[data-name="adminvtech_tks_devis"]' ).data("value") );

alert( $('*[data-name="adminvtech_tks_devis"]' ).data("value") );
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<input type="hidden" class="fieldBasicData" data-name="adminvtech_tks_devis" data-type="string" data-displayvalue="181" data-value="181">

Check out the documentation.

Fiddle

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!