How to get the innerHTML of selectable jquery element?
Use .val()
instead of .innerHTML
for getting value of selected option
Use .text()
for getting text of selected option
Thanks for correcting :)
$(function() { $("#select-image").selectable({ selected: function( event, ui ) { var $variable = $('.ui-selected').html(); console.log($variable); } }); });
or
$(function() { $("#select-image").selectable({ selected: function( event, ui ) { var $variable = $('.ui-selected').text(); console.log($variable); } }); });
or
$(function() { $("#select-image").selectable({ selected: function( event, ui ) { var $variable = $('.ui-selected').val(); console.log($variable); } }); });