Add text on selected .item-after on smart-select framework7 v2


#1

Hi @nolimits4web,

i have few select dropdown,
my code is:

document.getElementById(‘select1’).selected = true; //selects an option value
$$(’.select1 .smart-select .item-after’).html(‘select-1’); //shows the text

document.getElementById(‘select2’).selected = true; //selects an option value
$$(’.select2 .smart-select .item-after’).html(‘select-2’); //shows the text

the code on the top it’s not working, any advices?


#2

Probably it doesn’t match your HTML structure if it is not working


#3

ejm: HTML

<!select name=“gender” placeholder=“Su género” id=“generodoctor”>
Masculino
Femenino
</select!>

JS

var generodoctor = $$(‘select#generodoctor’).val();

clear I use f7 and iniz the app.


#4

Hi @nolimits4web,

Everything it’s working when I remove the class .select1 or .select2 like below code

$$(’.smart-select .item-after’).html(‘select’);

But the impact with all select element, I just want to reset the selected element only

Hi @erick123
Can you explain more detail.