Trying to get to the title attribute of a select box in appconnect


#1

Is there a way to get the title of the option selected in a select box. I can get the value with no prob but I would also like the title text. The values are coded into the local table not stored in a database. I can see where I can get it that way. Is that the only way or can it be done from the manually entered values.

If you can’t I’ll put the values in a db table but wanted to ask before I did that.

Thanks again,
Rick


#2

Not sure how to do this with Wappler. Was going to suggest using variables setValue and comma seperated strings ‘Apples’,‘Nice Red Apples’ for the option values and then {{ selectedText.value[1] }} BUT it appears only numbers work not strings.

However getting the option title is dead easy with a couple of lines of jquery, which you’ll most likely have hooked up to the page anyway if you’re using the current version of Bootstrap:

$('#selectID').change(function(){
var selectedText = $("#selectID option:selected").text();
$('.result').text(selectedText);
});

<div class="result"></div>

Anyhow its an option. Maybe someone else has come up against this at some stage and can provide a Wappler centric solution. I suppose normally you would expect the option value and the option title to be the same.


#3

worked great. Thank you so much.
Rick