function Compare&Add() {
var regex = /^Your Regular Expression$/;
var str = $("[id$='textboxid']").val();
var options = $("[id$='listboxid'] option");
var alreadyexist = false;
$("[id$='_promtlabel']").hide();
if (str.match(regex)) {
$(options).each(function () {
if ($(this).val() == str) {
$("[id$='_promtlabel']").show();
alreadyexist = true;
return;
}
})
if (!alreadyexist) {
$("[id$='listboxid']").append($("<option value = " + str + ">" + str + "</option>"));
$("[id$='textboxid']").val('');
return false;
}
}
Here is Simple Code by using JQuery,Pushing up the Textbox value to Listbox in Asp.Net
If Any Doubts Please Comment...
No comments:
Post a Comment