【发布时间】:2017-04-28 07:12:00
【问题描述】:
在开发者工具中我可以看到我的按钮:
<input type="submit" name="ctl00$MainContent$MapUserControl$MapDefPage$CreateEditLayerPage$addAttribute" value="Add Attribute" id="ctl00_MainContent_MapUserControl_MapDefPage_CreateEditLayerPage_addAttribute" title="Click to add a new attribute to the layer" class="edit green btn spaceRight" style="float: right; display: block;">
你可以看到样式最后有一个 BLOCK 的 DISPLAY。
但是当我尝试在控制台中测试时:
$('addAttribute').css("display") == "block"
false
当我看到它应该是 TRUE 时,我得到了 FALSE 的回报。为什么是这样? 基本上我想检查我的按钮是隐藏还是可见,以便我可以根据哪个执行任务。 也试过了
$('addAttribute').is(":visible");
false
但也返回 false。我究竟做错了什么? 谢谢
【问题讨论】:
-
addAtribute不是 id,也不是您输入中的类或其他。这正常吗? -
你的选择器是什么?没有对象
<addAttribute />,选择类使用.class,id -#id
标签: javascript jquery css styles block