Friday 7 May 2021

JQUERY26

 <html>

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script>

function addOption() {

var options = {

val1: 'JSP',

val2: 'PHP'

};

var selectOption = $('#programmingLanguage');

$.each(options, function (val, text) {

selectOption.append(

$('<option></option>').val(val).html(text)

);

});

}

</script>

</head>

<body>

<p>Programming Languages :</p>

<select id='programmingLanguage'>

<option value="Java" style="color: green;font-weight: 700;">Java</option>

<option value="CPP" style="color: green;font-weight: 700;">CPP</option>

<option value="C" style="color: green; font-weight: 700;">C</option>

</select>

<button onclick="addOption()">Add option</button>

</body>

</html>