How to get attribute value using Jquery

Answered
<div data-target="section1"></div>

How to get data-target value

Asked on August 4, 2017 in jQuery.
Add Comment



  • 1 Answer(s)
    Best answer

    Use the below code

    var value = jQuery('.classname').attr('data-target');
    
    

     

    In the above example .classname, class name of required element

    data-target is attribute

    Answered on August 4, 2017.
    Add Comment



  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.