Answers for "if select option element does not exist jquery"

2

jquery find if select option exists

$("#yourSelect option[value='yourValue']").length > 0;
Posted by: Guest on June-16-2020
0

jquery add option if not exist

var optionExists = ($('#columnsAvailable option[value=' + $(this).val() + ']').length > 0);

if(!optionExists)
{
    $('#columnsAvailable').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
}
Posted by: Guest on March-16-2020

Code answers related to "if select option element does not exist jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language