Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS Newbie - How to dynamically move buttons
    primarykey
    data
    text
    <p>I have a form that I'm modifying after it's been rendered via jquery - only because I have no control over the code that creates the form. </p> <p>In any case, I'm adding a button beside the login button that's a part of the form. In order to do this, I'm using the following jquery: </p> <pre><code>$('.mynewbutton').hide(); $(".submit").addClass("buttonalign"); $('&lt;div class="shared"&gt;').insertBefore($('.submit')); $('.submit').after($('&lt;div class="circle circlealign"&gt;i&lt;/div&gt;')); </code></pre> <p>The new button I'm adding is actually a circle that I've drawn using css. This works fine - the new button is aligned with the login. Here's the css: </p> <pre><code>.shared { position: absolute; width: 200px; } .buttonalign { position: absolute; top:340px; } .circlealign { position: absolute; top:340px; } </code></pre> <p>The problem I need to resolve is when the login form returns an error message, it displays the error at the top of the form and pushes everything down. So my login button and the new button end up covering over some other elements on the form because their position is fixed.</p> <p>I changed the fixed numbers to percentages and em like so: </p> <pre><code>.shared { position: absolute; width: 100%; } .buttonalign { position: absolute; top:40em; } .circlealign { position: absolute; top:40em; } </code></pre> <p>But that has change the position of the new button so that it no longer is aligned with the login button. it's way lower on the page.<br> Can you point me in the right direction? </p> <p>Thanks. </p> <p><strong>EDIT 1</strong></p> <p>Here's the rendered HTML.. and ofcourse the jquery stuff doesn't appear here which is a pain.. but you can see what the initial form looks like</p> <pre><code>&lt;H1&gt;Login&lt;/H1&gt;&lt;DL&gt; &lt;P class="err"&gt;Logon Failed&lt;/P&gt; &lt;form action="/cgi-bin/logon/logon" method="POST"&gt; &lt;DT&gt;User ID&lt;/DT&gt; &lt;DD&gt; &lt;input class=" text" type="text" name="userid"&gt; &lt;/DD&gt; &lt;DT&gt;Password&lt;/DT&gt; &lt;DD&gt; &lt;input class=" password" type="password" name="password" &gt; &lt;/DD&gt; &lt;DT&gt;&lt;/DT&gt;&lt;DD&gt;&lt;input class="submit" type="submit" name="submit" value="Logon"&gt; &lt;/DD&gt; &lt;/FORM&gt;&lt;/DL&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload