gfranko / jquery.selectBoxIt.js

A jQuery Select Box Plugin for Mobile, Tablet, and Desktop
http://www.selectboxit.com
MIT License
852 stars 301 forks source link

use onclick in option #344

Closed KinG-InFeT closed 8 years ago

KinG-InFeT commented 8 years ago

Hi,

Hello , I would use the 'click on the options like this:

<select>
    <option onclick="alert(1);">test 1</option>
    <option onclick="alert(2);">test 2</option>
</select>

but the plugin does not allow Apple to do, you have any idea?

thank you

mladimatija commented 8 years ago

You can always use option-click event like this:

$("select#test").bind({
   "option-click": function(ev, obj) {
      $('this').alert('what-you-want-to-alert');
   }
});
KinG-InFeT commented 8 years ago

thanks for the answer, but as I do now to pick up the val attribute of the selected option?

EDIT: resolved: console.log(obj.selectboxOption[0].attributes[0].nodeValue);