2014-11-05 92 views
0

我尝试修改UserVoice的表单。修改Uservoice Textarea占位符

这里控件的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') 

感谢

回答

0

我刚刚注意到uservoice使用一个iframe作为widget! 对不起!

0

您正在试图得到一个属性命名类,而不是占位符。

修改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"); 

可以使用“如果设定特定条件“如果需要的话。

+0

是的,我测试这个,但它不起作用。在我的例子中,它只是为了捕捉对象而没有任何东西。 uservoice对象不存在我的脚本... – madvic 2014-11-06 08:12:18

+0

我更新了代码...给该textarea一个ID,然后选择该ID。 console.log($(“#switch”));会将该对象转储到浏览器的控制台。 – Solrac 2014-11-08 00:44:18

+0

是的但是这个textarea是由uservoice代码创建的,没有给出ID! – madvic 2014-11-10 15:25:14