Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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>");
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery #add #option #exist
ADD COMMENT
Topic
Name
3+7 =