<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
function DynamicBind()
{
var Ttext="India";//CountryName -> this is visible
var Tvalue="CId-1";//CountryId -> this is invisible for secure back hand code
$("#textandvalueSET").append($('<option></option>').val("").html("-Select-"));
$("#textandvalueSET").append($('<option></option>').val(Tvalue).html(Ttext));
}
function ShowDropTextValue()
{
var countrySelect = document.getElementById("textandvalueSET");
var selectedText = countrySelect.options[countrySelect.selectedIndex].text;
alert(" Selected Text: "+selectedText);
var vv=document.getElementById("textandvalueSET").value;
alert(" Selected Value= "+vv);
}
</script>
</head>
<body>
<br/>
<br/>
<input type="button" value="Dynamic" onclick="DynamicBind()"/>
<select id="textandvalueSET" onchange="ShowDropTextValue()">
</select>
</body>
</html>