简体   繁体   English

大孩子输入类型的JQuery设置内联属性

[英]JQuery Setting inline attribute in Grand children input type

I'm in ASP.NET MVC. 我在ASP.NET MVC中。 I need to modify an input tag with JQuery to set placeholder="Something" 我需要使用JQuery修改输入标签以设置placeholder =“ Something”

I have these tags in a form 我有这些标签的形式

<div id="searchbox" class="SearchBox SearchInterface state 
ComponentState QueryController Debug">

    <div>
        <input type="text" autocapitalize="off" autocorrect="off" 
        class="QueryBox" form="dummy-form">
    </div> 
</div>

I have tried many things such as 我尝试了很多事情,例如

$(document).ready(function () {
    $("#searchbox > div > input").prop('placeholder', 'Search');
});

But It's always like it can't find the input tag. 但这总是找不到输入标签。

What's wrong with that and how I can do that ? 那有什么问题,我该怎么做?

Thanks, 谢谢,

here it is working: http://fiddle.jshell.net/9dRc8/ 它在这里工作: http : //fiddle.jshell.net/9dRc8/
Seams you are missing a closing tag for the input or something like this. 似乎您缺少输入的结束标记或类似内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM