我的简单jquery脚本出了什么问题?

时间:2016-12-01 19:10:59

标签: javascript jquery

你可以在jshint上看到是什么。 .prop registerUserButton似乎存在问题。

$(document).ready(function() {
  console.log("ready");
  $('#registerUserButton').prop("disabled", true);

  $('#reg_passwordConfirm').bind('keyup', function() {
    var Password = $("#reg_password");
    var confirmPassword = $("#reg_passwordConfirm");

    if ((Password == confirmPassword) && (Password > 1) && (confirmPassword == 1)) {
      $('#registerUserButton').prop("disabled", false);
    }
  });
});

3 个答案:

答案 0 :(得分:1)

var Password = $("#reg_password");
var confirmPassword = $("#reg_passwordConfirm");

应该是

var Password = $("#reg_password").val();
var confirmPassword = $("#reg_passwordConfirm").val();

答案 1 :(得分:1)

var Password = $("#reg_password").val();
var confirmPassword = $("#reg_passwordConfirm").val();
(Password.length > 1) && (confirmPassword.length  == 1)

或许可以解决您的问题

答案 2 :(得分:0)

你好首先你在表格值的恢复中犯了一些错误,我编辑了一下脚本+修正了错误并添加了评论

using Microsoft.EntityFrameworkCore;
using AppWebsite.Models;

namespace App.Models
{
    public class AppContext : DbContext
    {
        public DbSet Events { get; set; }
        protected override void OnModelCreating(ModelBuilder builder)
        {
            builder.Entity().HasKey(m => m.Id);
            base.OnModelCreating(builder);
        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            string constr = Utility.GetConnectionString("ConnectionStrings:DefaultConnection");
            string path = System.IO.Directory.GetCurrentDirectory();
            constr = constr.Replace("=", "=" + path + "\\");
            optionsBuilder.UseSqlite(constr);
        }
    }
}