Skip to main content
added 56 characters in body
Source Link
Mohd Abdul Mujib
  • 14.2k
  • 8
  • 73
  • 93

I'd like to add, If you want to target a specific <select>

You can also pass the container element so that <options> from only that element will be selected.

// For user with events like .on("change") etc.
console.log($("option:selected", this).attr("data-lat")); 

OR

console.log($("option:selected", "#areas").attr("data-lat"));

I'd like to add, If you want to target a specific <select>

You can also pass the container element so that <options> from only that element will be selected.

console.log($("option:selected", this).attr("data-lat"));

OR

console.log($("option:selected", "#areas").attr("data-lat"));

I'd like to add, If you want to target a specific <select>

You can also pass the container element so that <options> from only that element will be selected.

// For user with events like .on("change") etc.
console.log($("option:selected", this).attr("data-lat")); 

OR

console.log($("option:selected", "#areas").attr("data-lat"));
Source Link
Mohd Abdul Mujib
  • 14.2k
  • 8
  • 73
  • 93

I'd like to add, If you want to target a specific <select>

You can also pass the container element so that <options> from only that element will be selected.

console.log($("option:selected", this).attr("data-lat"));

OR

console.log($("option:selected", "#areas").attr("data-lat"));