Jquery 如何将模糊和聚焦事件绑定到ajax组合框

Jquery 如何将模糊和聚焦事件绑定到ajax组合框,jquery,Jquery,我试过这种东西 $('#<%= txtSponsorBC2.ClientID %>').focus(function () { var selectedDate = $('#txtMandateDate').datepicker('getDate'); var currentDate = new Date(); currentDate.setHours(0); currentDate.setMinutes(0);

我试过这种东西

$('#<%= txtSponsorBC2.ClientID %>').focus(function () {
        var selectedDate = $('#txtMandateDate').datepicker('getDate');
        var currentDate = new Date();
        currentDate.setHours(0);
        currentDate.setMinutes(0);
        currentDate.setSeconds(0);


        if ($("#txtMandateDate").val() != "" && $("#txtMandateDate").val() != "dd/mm/yyyy") {
            if (Date.parse(selectedDate) < currentDate) {
                return true;
            }
            else {
                alert(" date cannot be future date");
                return false;
            }
        }

    });
$('#')。焦点(函数(){
var selectedDate=$('#txtMandateDate')。日期选择器('getDate');
var currentDate=新日期();
currentDate.setHours(0);
currentDate.setMinutes(0);
currentDate.setSeconds(0);
如果($(“#txtMandateDate”).val()!=”&&($(“#txtMandateDate”).val()!=“dd/mm/yyyyy”){
if(Date.parse(selectedDate)
如果我使用
$('#')
访问ajax组合框,我会得到一个错误

Microsoft JScript runtime error: Syntax error, unrecognized expression: #<%= txtSponsorBC2.ClientID %>
Microsoft JScript运行时错误:语法错误,无法识别的表达式:#
试试
$('#'+)