iamkevinjohnson pro asked 6 years ago

var states = ["Alabama","Alaska","Arizona","Arkansas","California"]; In addition to state name, I need hidden corresponding value/code for each state? For example: AL, AK, AZ, AR, CA. Looking for an example. Thanks

iamkevinjohnson pro answered 6 years ago


Adrian Sawicki free answered 6 years ago

Hello Iamkevinjohnson, Here you have an example of how to add additional value to choices.
var states = [
var data = [

    data: states

$('.mdb-autocomplete').on('mouseenter', function() {
    var index = jQuery.inArray($(this).val(), states);
        $(this).attr("data-value", data[index])
Regards, Adrian

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.


Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: No