Instead of .val()
use .text()
, like this:
$(".ui-datepicker-month").live("click", function () {
var monthname = $(this).text();
alert(monthname);
});
Or in jQuery 1.7+ use on()
as live
is deprecated:
$(document).on('click', '.ui-datepicker-month', function () {
var monthname = $(this).text();
alert(monthname);
});
.val()
is for input type elements (including textareas and dropdowns), since you're dealing with an element with text content, use .text()
here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…