小编Sea*_*ean的帖子

jquery .prop('disabled',true)无效

我试图切换disabled = true|false<input type="text">,使用复选框.我能够获得输入的值,但我无法将输入设置为禁用.

我的jquery/js代码

<script>
$(function () {
    $('.date').datepicker();
    $('body').on('change', '.housing', function () {
        if ($(this).val() == 'dorms') {
            $(this).parent().next(".dorms").show();
        } else {
            $(this).parent().siblings(".dorms").hide();
        }
    });
    $('body').on('change', '.single', function () {
        if ($(this).checked) {
            $('#echo1').text($(this).prev(".roommate").val());  // this works
            $(this).prev(".roommate").val(''); // does not empty the input
            $(this).prev(".roommate").disabled = true; // does not set to disabled
            $(this).prev(".roommate").prop('disabled', true);  // does not set to disabled
            $('#echo2').text($(this).prev(".roommate").prop('disabled')); // always says false
        } else {
            $('#echo1').text($(this).prev(".roommate").val()); // this works
            $(this).prev(".roommate").disabled …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

6
推荐指数
1
解决办法
2万
查看次数

我的SQL查询有什么问题?(PHP)

这段代码有什么问题?为什么我不能username从数据库中的members表中获取website.这是数据库信息的屏幕截图:

在此输入图像描述

我正在尝试为它创建一个函数,以便我以后可以使用它.这是代码:

<?php
function get_username($username){
    $host = 'localhost';
    $username = 'root';
    $password = '';
    $database = 'website';
    $con = mysqli_connect($host, $username, $password, $database);

    $query = "SELECT * FROM members WHERE username = '{$username}'";

    $result = mysqli_query($con, $query);

    $row = mysqli_fetch_array($result);

    return $row['name'];

    mysqli_close($con);
}

echo get_username('iamfaizahmed');
?>
Run Code Online (Sandbox Code Playgroud)

php mysql sql

1
推荐指数
1
解决办法
89
查看次数

标签 统计

javascript ×1

jquery ×1

mysql ×1

php ×1

sql ×1