Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6775655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:55:56+00:00 2026-05-26T15:55:56+00:00

I’m affecting the CSS to make the absolute position change. jQuery – this changes

  • 0

I’m affecting the CSS to make the absolute position change.

jQuery – this changes the absolute positioning to the top left and top right, eventually I want to do it for all corners but I’m starting with this

$('#topLeft').click(function() {
    $('#questionField').css('top', '0');
    $('#questionField').css('left', '0');
});

$('#topRight').click(function() {
    $('#questionField').css('top', '0');
    $('#questionField').css('right', '0');
});

HTML (aren’t all my IDs and such correct?):

<body>
    <div id="questionField">    
        <form id="questions" action="process.html">
            <fieldset>
                <legend>Hello World!</legend>
                <p>Firstly, which corner would you like this question box to be in?</p>
                <input type="radio" name="corner" id="topLeft" /><label for="topLeft"> Top Left</label><br />
                <input type="radio" name="corner" id="topRight" /><label for="topRight"> Top Right</label><br />
                <input type="radio" name="corner" id="bottomLeft" /><label for="bottomLeft"> Bottom Left</label><br />
                <input type="radio" name="corner" id="bottomRight" /><label for="bottomRight"> Bottom Right</label><br />

                <p>Now, some questions.</p>
                <label for="color">Favorite Color: </label><input type="text" id="color" /><br />
                <label for="animal">Favorite Animal: </label><input type="text" id="animal" /><br />
            <label for="paintBrush">Favorite Paint Brush: </label><input type="text" id="paintBrush" /><br />
                <label for="movie">Favorite Movie: </label><input type="text" id="movie" />
            </fieldset>
        </form>
    </div>
</body>

CSS (it works if I affect this manually without jQuery, but jQuery doesn’t seem to want to affect it!):

#questionField {
    position: absolute;
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    padding: 10px;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:55:57+00:00Added an answer on May 26, 2026 at 3:55 pm

    There are some subtleties that mean that your code, while correct, won’t work…

    1. Your #questionField element is currently 100% wide, so it is already touching the left side of the page (left: 0) and the right side of the page (right: 0). You need a width of less than 100% to see a change from left to right.

    2. You should set position: absolute to use fixed co-ordinates for an element

    3. Although these adjustments will work (See my JS Fiddle) Once you have clicked, you may get odd behaviour, for example, if I click top left, then top right, then top left, then top right, the box will stop moving as it gets confused when you have both left: 0 and right: 0 set – it cannot satisfy both rules and will choose to stick to the left. You need to revert the properties you previously set to make this work. Here is the full working code (assuming you have put a width on the element).

       $(document).ready(function () {
          $('#topLeft').click(function() {
              $('#questionField').css({
                  position: 'absolute',
                  'top': '0px',
                  'left': '0px',
                  'right': 'auto'
              });
           });
      
           $('#topRight').click(function() {
              $('#questionField').css({
                  position: 'absolute',
                  'top': '0px',
                  'right': '0px',
                  'left': 'auto'
              });
          });
      });
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.