Topic: auto complete
iamkevinjohnson pro asked 8 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
Adrian Sawicki answered 8 years ago
var states = [
"Alabana",
"Alaska",
"Arizona",
"Arkansas",
"California"
];
var data = [
"Al",
"Ak",
"Ar",
"Ark",
"Cal"
]
$('.mdb-autocomplete').mdb_autocomplete({
data: states
});
$('.mdb-autocomplete').on('mouseenter', function() {
var index = jQuery.inArray($(this).val(), states);
$(this).attr("data-value", data[index])
console.log($(this).attr("data-value"));
})
Regards,
Adrian
iamkevinjohnson pro answered 8 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No