I am very new to JQuery - I looked but could not find answers simple enough for my issues... I have HTML drop down list (generated by a db file) with an ID on a selection common to all lists. It is on this "Add a New" option that I would like to trigger an event that will immediately slide open a div that will allow input & update of a new name to the list.
<select name="NAME" id="NMDROP">
<option value=""></option>
<option value="JOE">Joe</option>
<option value="BOB">Bob</option>
<option id="ADDNM" value="ADD">Add a New Name</option>
</select>
This is the jQuery I am hoping will allow me to call an update pgm.
jQuery(document).ready(function () {
//Jquery for Adding a SalesPerson
$("#ADDNM").click(function () {
if ($(this).is(":clicked")) {
jQuery.ajax({
url: "Update.pgm",
type: "POST",
data: {
"task": "ajax_addsp",
"ajax_add": 'Y',
"NAME": NAME
},
success: function () { alert("success:");
},
error: function () { alert("error on Add a New Name " + data);
}
});
}
});
});
I am confident that many of you will be able to spot my fundamental errors. I am not even sure if this is a click or a change event, I have seen it both ways on this site.
ADDNMunique?id. Look: w3.org/TR/html-markup/option.html