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

129
Views
How to alert selectize attr?

I'm using selectize plugin and trying to alert custom data-attribute.

I tried with several method but it alway indefined result My select list :

<select name="location_work{{counter}}" id="location_work{{counter}}" class="list_type_op" data-md-selectize-inline required>
    <option data-data='{"param": 0}'  value="1">Construction</option>
    <option data-data='{"param": 1,"name":"x"}' value="2">Puchase</option>
    <option data-data='{"param": 2,"name":"x-y"}' value="3">Warranty</option>
</select>

And my js function

    $(document).on('change', '.list_type_op', function () { 
        var selected_option = this.value;
        var nbParam =  $('option:selected', this).attr('data-param');
        alert(nbParam); //is indefined
    });

Select list is in Estimated price section on Type Column

Here my jsfiddle : Jsfiddle

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

0

Finally i get value of attribute with this :

$(document).on('change', '.list_type_op', function () { 
    var selected_option = this.value;
    var nbParam =  $(".selectize-dropdown-content").find(`[data-value='${selected_option}']`).attr('data-param');
    alert(nbParam);
});

I search attribute in html code.

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!