Modify Uservoice Textarea placeholder

92 Views Asked by At

I try to modify the form of UserVoice.

Here the html code of the widget :

<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>

I want to modify the placeholder of textarea, but It's impossible to access it.

Exemple :

jQuery('textarea').attr('class')   ->   <nothing>   (otherwise: 'textbox')

Thanks

2

There are 2 best solutions below

0
madvic On BEST ANSWER

I just noticed that uservoice uses an iframe for the widget! Sorry!

3
Solrac On

You are trying to get an attribute named class instead of placeholder.

Modify the html to give the textarea an id:

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

as for the js code, select the id instead of the textarea:

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

You can set specific conditions using "if" blocks if needed.