I think it will be very simple for anyone who is decent with jQuery, but I have dynamically generated dropdownlists on my page and I set up a click event on the class, which, as expected, fires a click event for all of them. The identifier is selectdynamically generated, so I cannot use it as a selector. I just want to fire an event for selectthat has really been changed.
I need to use the id of the selected value in a function - does anyone know how to do this?
The code I still have:
$(document).ready(function () {
$(".boxItem").change(function () {
var str = $(this).attr('id');
var num = $(this).val();
alert(num);
var url = "/Search/GetBoxChangeInfo";
var vmData = { json : @Html.Raw(Json.Encode(Model)),
id : str,
boxNo : num };
$.post(url, vmData, function (data) {
$("#column-1").html(data);
});
});
});
Many thanks
source
share