Select an option with ajax content

webcrea 24 Jul, 2020
Hi,

I try to select an option with the result of an ajax request.
All my test :
document.getElementByName('add_result').option[value="' + items['result'] + '"].attr('selected', true);
jQuery('#add_result option[value="' + items['result'] + '"]').attr('selected', true);
add_result.val(items['result']);
jQuery("#add_result").children("option").val(items['result']);
The selector named and his id is add_result
the var defined as :
add_result = jQuery("#add_result");
Do you ahev any idea
Thanks
Chris
Max_admin 25 Jul, 2020
if you are trying to select an option:
$("#select_id").find("option[value="+value goes here+"]").prop("selected", true);
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
webcrea 25 Jul, 2020
Thanks Max,

But no, it doesn't.
I'm going to change the method. Create a new form to manage results.

regards
webcrea 10 Nov, 2020
UP UP UP

Hello Max,

Sorry but I NEED to change select with ajax request.
How can I do it?

It's very important.

I don't understand why the select is hidden. Why this div after?
It should be easier to have only a simple select???

Thanks for your help
Max_admin 21 Nov, 2020

Sorry but I NEED to change select with ajax request.


Reload it!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.