Javascript JQuery没有看到div

Javascript JQuery没有看到div,javascript,jquery,Javascript,Jquery,html代码页的一部分: <td class="calendar-footer-cell" style="min-width: 135px; max-width: 135px;"> <table id="in_out_time" style="cursor: pointer; color:#BBBBBB; font-family: cbuc-icons Regular, cbuc-icons;"> <tbody>

html代码页的一部分:

<td class="calendar-footer-cell" style="min-width: 135px; max-width: 135px;">
    <table id="in_out_time" style="cursor: pointer; color:#BBBBBB; font-family: cbuc-icons Regular, cbuc-icons;">
        <tbody>
            <tr class="field-label">
                <td id="timeIdName" style="width: 100px; white-space: nowrap; padding-right: 5px; height: 20px">09:52</td>
                <td class="table_td_all_time" style="width: 100px; text-align: right;">04:08</td>
            </tr>
            <tr class="field-label">
                <td class="table_time_in_out" style="width: 100px; height: 20px;">09:52</td>
            </tr>
        </tbody>
    </table>
</td>
在css设置中的“timeIdName”块中,您希望将“空白”更改为“pre”

如果您正在使用:

$('#timeIdName').css("white-space", "pre");
没有什么变化


您能告诉我如何更改设置吗?

在文档准备事件中输入以下代码,它应该可以工作

$(document).ready(function(){
    $("#timeIdName").css("white-space", "pre");
});

更正您的输入错误并使用documet ready,它应该可以:

$(function(){
    $('#timeIdName').css("white-space", "pre");
});
我们应该仅在触发document ready事件后选择任何元素。以上是以下内容的简写:

$(document).ready(function(){
     $('#timeIdName').css("white-space", "pre");
});

请仔细检查您的代码,您没有正确使用引号

$('#timeIdName').css("white-space", "pre");

注意选择器中的结束单引号。

应该可以。您的代码是否在
$(document).ready()
中?选择器中有一个键入错误-缺少结束引号。感谢@rorymcrossan提供格式设置。这是一项吃力不讨好的任务。请确认不是我,但我想这是因为你的答案中的引号仍然有错误。
$('#timeIdName').css("white-space", "pre");