0

我尝试修改 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')

谢谢

4

2 回答 2

0

您正在尝试获取名为 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" />

至于js代码,选择id而不是textarea:

$("#switch").attr( "placeholder", "New value of placeholder");

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

于 2014-11-05T22:44:55.170 回答
0

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

于 2014-11-10T17:39:50.420 回答