title: How to capture value of an attribute in JavaScript not jQuery
body: <p>I want to capture the value of an attribute on an  tag using JavaScript. I am not yet successful doing so.</p>
  
  <p>Here's my HTML markup:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  ...
    &lt;!-- bootstrap-slider Plugin --&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/bootstrap-slider.min.js"&gt;&lt;/script&gt;
    &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/css/bootstrap-slider.min.css" rel="stylesheet"&gt;    
  ...
  &lt;/head&gt;
  &lt;body&gt;
  ...
      &lt;div class="form-group"&gt;
        &lt;label class="col-md-4 control-label" for="language_spanish"&gt;Spanish&lt;/label&gt;
        &lt;div class="col-md-6"&gt;
          &lt;input id="language_spanish" type="text" data-provide="slider"
            data-slider-ticks="[0,1,2]"
            data-slider-min="0"
            data-slider-max="2"
            data-slider-step="1"
            data-slider-value="0"
            data-slider-tooltip="show"
            data-identifier="this is what I want to capture"
          /&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  ...
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is my javascript:</p>
  
  <pre><code>var spanish = new Slider( '#language_spanish', { formatter } );
  spanish.on( 'slideStop', function( value ) {
    alert( value ); // this works perfectly!
    alert( this.getAttribute( 'data-identifier' ) ); // does not work
    alert( spanish.getAttribute( 'data-identifier' ) ); // does not work either
    alert( spanish.attr( 'data-identifier' ) ); // does not work as well
  });
  </code></pre>
  
  <p>Is it possible?</p>
  
  <p><strong>FYI jQuery does not work with bootstrap-slider. Tried and tried and tried and I keep hitting brick walls. JavaScript has been the only way I can use this plugin to retrieve values and attributes.</strong></p>
  
  <p>Amended to include source of plugin:</p>
  
  <p><a href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/bootstrap-slider.min.js" rel="nofollow noreferrer">https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/bootstrap-slider.min.js</a></p>
  
  <p><a href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/css/bootstrap-slider.min.css" rel="nofollow noreferrer">https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.7.2/css/bootstrap-slider.min.css</a></p>