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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:04:58+00:00 2026-05-27T20:04:58+00:00

i am a bit new to using jquery, the following should display a button,

  • 0

i am a bit new to using jquery, the following should display a button, and when someone clicks the button, the font size of that button should change.

Unfortunately, the button does not change its font size, for reasons i am not sure of.

Edit:
this example is the same one as before with adjustments, it works but it will only change font, once the mouse has left the button’s area or if the button has be double clicked.

The font should change on only 1 click.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
  $(".button0").click(function() {
    $('.button0').css('font-size', '43px');
  });
});
</script>
<style type="text/css">
.button0{
position:fixed;
left:48px;
top:55px;
font-family:Arial;
font-size:8px;
font-weight:normal;
}
</style>
<body>
<div name="button0"><input class="button0" type="button" style="width: 148px;height: 72px;" value="Button"/></div>
</body>
</html>
  • 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-27T20:04:59+00:00Added an answer on May 27, 2026 at 8:04 pm

    You have to make sure the document is ready—as in, all elements have loaded—before making modifications.

    Wrap everything in this function:

    $(document).ready(function(){
        // your code here
    });
    

    Besides that, your selector is looking for a div element with a class of button0 when you’re trying to modify an input element. Modify your selector to say input.button0.

    Also, jQuery has a $(this) selector which selects the current element. In your case it will select the clicked input.

    And finally, since you’re using jQuery 1.7.1, I’ll introduce you to on(). It’s generally recommended to delegate events using this function. Instead of $(div).click(), use this:

    $(document).on("click", "input.button0", function(){
        $(this).css("font-size", "43px");
    });
    

    More about on() here.

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

Sidebar

Related Questions

The following bit of code catches the EOS Exception using (var reader = new
So I am very new to using jQuery and I have a script that
A bit new with WPF...It seems like not matter what I change with horizontal
I am a bit new to reusable plugins for jquery. I have ran across
I'm using a jquery plugin that is supposed to accept options, but isn't for
I'm still a bit new on jquery selection syntax (and jquery in general). I'm
Is there anyway that i can open a new window in the browser using
I am using the following piece of jQuery code: $('div#addMenu1').click(function(){ if (!menuSet1){ menuSet1 =
I am just beginning a new site and I am using jQuery UI Accordion
I am using this bit of jQuery code to get href of the link:

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.