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 8543817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:23:58+00:00 2026-06-11T12:23:58+00:00

I have a browser check: $(document).ready(function() { if ($.browser.chrome) { //show document write input

  • 0

I have a browser check:

$(document).ready(function() {
if ($.browser.chrome) {
  //show document write input only if chrome = true else, ignore it
}
});
</script>

HTML

<input name="name" type="text" size="30" maxlength="50" **IF CHROME == TRUE? document.write("style="position:relative; margin-top:-3px; margin-left:-1px;"");** >

Obviously the above is incorrect .. Can someone please explain the proper way of doing this? Thanks!

  • 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-06-11T12:23:59+00:00Added an answer on June 11, 2026 at 12:23 pm

    While I am not a fan of this one-off hack, the following explains how it can be obtained given that $.browser.chrome evaluates as expected.


    The document cannot be written to inline at this point, however, the attributes of the element can be changed. For instance, inside the conditional if-check:

    $(inputSelector).attr('style',
        'position:relative; margin-top:-3px; margin-left:-1px;');
    

    However, since the style attribute, which is “text”, is synthesized to a “stye object”, it is usually best to avoid text-DOM access. This can be achieved using the jQuery.css method:

    $(inputSelector).css({
        position: 'relative',
        marginTop: '-3px',
        marginLeft: '-1px'
    })
    

    Where inputSelector is an appropriate selector to match the appropriate element(s). For instance, <input name="theName" .. can be matched with [name="theName"]. See jQuery selectors for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using browser firefox and chrome I have an input file element. <input type='file' id='tempFileInput'
After adding this short js code: $(document).ready(function() { //check to see if it's an
I have this inside my $(document).ready function: $(window).unload(function() { check_saved(); }); check_saved() just triggers
How do I check if browser supports position:fixed using jQuery. I assume I have
Can you check if this is a browser cache problem? I have this scenario,
I currently have built a system that checks user IP, browser, and a random-string
I have an Ajax site where I have browser navigation hooked up to ajax
With the new Silverlight 5, we can now have an In-Browser elevated-trust application. However,
I have a simple web browser embedded in an application that allows a user
I have created a web browser in c# this was what i get when

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.