$(this).data() 修剪从数据库中传递的数据,直到出现空格


$(this).data() trims the passed data from a database until a whitespace

除了我获取带有空格的数据的部分外,一切正常。我想获取整个数据字符串,而不是修剪后的数据。
在我的示例中,每次我获得"数据标题"或"数据类型"时,数据都会被剪切到空格。
我尝试在"数据标题"中放置一个静态数据字符串,它运行良好。但是当我传递一个来自数据库的动态文件时,它会被修剪直到空格。$row[1] 完美地显示在链接上,但在传递时会被修剪。

.HTML

<a href='#manage_question_window' class='manage_question' data-toggle='modal' data-target='#manage_question_window' data-id=$row[0] data-title=$row[1] data-type=$row[2]>$row[1]</a>  
<div class="modal fade" id="manage_question_window"> <!-- START management -->
        <div class="modal-dialog">
            <div class="modal-content">
                <!-- HEADER -->
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h2 class="modal-title text-center">Manage Question</h2>
                </div>
                <!-- BODY -->
                <form role="form" class="form-horizontal">
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="manage_input_question" class="col-sm-2 control-label">Question</label>
                            <div class="col-sm-10">
                                <textarea name="question" class="form-control" id="manage_input_question" placeholder="Question" style="resize:none;"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="manage_input_type" class="col-sm-2 control-label">Answer Type</label>
                            <div class="selectContainer col-sm-10">
                                <select name="type" class="form-control" id="manage_input_type">
                                    <option value="Multiple Choice With Unique Answer">Multiple Choice With Unique Answer</option>
                                    <option value="Multiple Choice With Multiple Answer">Multiple Choice With Multiple Answers</option>
                                    <option value="True or False">True or False</option>
                                    <option value="Identification">Identification</option>
                                </select>
                            </div>
                        </div>
                    </div>
                        <!-- BUTTON -->
                    <div class="modal-footer">
                        <input type="button" id="create_btn" name="create" class="btn btn-primary btn-block" value="Create">
                    </div>
                </form>
            </div>
        </div>
    </div>

JavaScript

$(document).on("click", ".manage_question", function () {
    var question_id = $(this).data('id');
    var question_title = $(this).data('title');
    var question_type = $(this).data('type');
    $(".modal-body #manage_input_question").val( question_title );
    $(".modal-body #manage_input_type").val( question_type );
});

好的,我在这里发现了我的错误。而不是

data-id=$row[0] data-title=$row[1] data-type=$row[2]  

它应该用引号括起来。

data-id=$row[0] data-title='$row[1]' data-type='$row[2]'