Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 修改用户语音文本区域占位符_Javascript_Jquery_Uservoice - Fatal编程技术网

Javascript 修改用户语音文本区域占位符

Javascript 修改用户语音文本区域占位符,javascript,jquery,uservoice,Javascript,Jquery,Uservoice,我尝试修改UserVoice的形式 下面是小部件的html代码: <article class="widget large-widget"> <div class="viewport vertical-layout" data-viewport="" style="height: 325px;"> <section class="pane instant-answers-omnibox-input-pane" style="display: bloc

我尝试修改UserVoice的形式

下面是小部件的html代码:

<article class="widget large-widget">
    <div class="viewport vertical-layout" data-viewport="" style="height: 325px;">
    <section class="pane instant-answers-omnibox-input-pane" style="display: block;">
    ....

        <form>

            <div class="pane-body" style="top: 48px; bottom: 119px; height: 158px;">
                <div data-stretch-vertical="" style="height: 158px;">
                    <textarea 
                         placeholder="Give feedback or ask for help…" 
                         data-autofocus="" 
                         data-search-input="" 
                         class="textbox textarea full-width full-height">
                    </textarea>
                </div>
           </div>

           ....

        </form>
     </section>
     </div>
</article>

....
....
我想修改textarea的占位符,但无法访问它

例如:

jQuery('textarea').attr('class')   ->   <nothing>   (otherwise: 'textbox')
jQuery('textarea').attr('class')->(否则:“textbox”)

谢谢

您正在尝试获取名为class的属性,而不是占位符

修改html以给textarea一个id:

<textarea id="switch"
placeholder="Give feedback or ask for help…" 
data-autofocus="" 
data-search-input="" 
class="textbox textarea full-width full-height" />

如果需要,您可以使用“if”块设置特定条件。

我刚刚注意到uservoice为小部件使用了一个iframe!
对不起

是的,我测试了这个,但它不起作用。在我的例子中,它只是为了捕捉对象,而不是什么。我的脚本不存在uservoice对象…我更新了代码。。。给该文本区域一个ID,然后选择该ID.console.log($(“#开关”);将该对象转储到浏览器控制台。是,但此文本区域由uservoice代码创建,没有提供ID!
$("#switch").attr( "placeholder", "New value of placeholder");