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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:05:00+00:00 2026-06-05T07:05:00+00:00

I have a function that uses a cached element(el) to change the font size

  • 0

I have a function that uses a cached element(el) to change the font size of 2 divs. When the function executes I need to make sure the font is not too small or too large based on which div it is(tagCommon or tagLatin). So how can I determine in the function which element was passed to it via el?

I think I may be over thinking this or doing it wrong, it kinda feels like I am hacking it in…and usually when it feels like that there is something wrong.

var cb               = $('#tagCommon');
var lb               = $('#tagLatin'); 
changeFontSize(cb,1,'up');

function changeFontSize(el,amount,UporDown){
   var size = parseFloat($(el).css("font-size").replace(/px/, ""));
   // do some stuff here

   // ????????
   if(el == $('#tagCommon')) //check font size and alert if too small
   if(el == $('#tagLatin')) //check font size and alert if too small
}

Thank you for your time.

Todd

  • 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-05T07:05:01+00:00Added an answer on June 5, 2026 at 7:05 am
    function changeFontSize(el,amount,UporDown){
       var size = parseFloat($(el).css("font-size").replace(/px/, "")),
           id = el.attr('id'); // or el[0].id
    
       if(id == 'tagCommon') //check font size and alert if too small
       if(id == 'tagLatin') //check font size and alert if too small
    
       // OR
       if(id == 'tagCommon')
       if(id == 'tagLatin')
    
       // OR
       if(el.is('#tagCommon'))
       if(el.is('#tagLatin'))
    }
    

    .attr('id') will retrieve the id and match with supplied one

    .is() matched set of elements against a selector, element, or jQuery object. Return value boolean true/false.

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

Sidebar

Related Questions

I have a model function that I want to make sure uses a transaction.
I have a function that uses comma as separator in breaking name/email pairs from
I have a function that uses Pattern#compile and a Matcher to search a list
I have a function that uses out parameters to return multiple values to the
I have a function that uses CDO to send emails with request to have
I have a function that uses the SharePoint api so the method SPUtility.GetLocalizedString is
I have a function that uses the Google Blobstore API, and here's a degenerate
I currently have a Javascript function that uses a string to reference an object
I have written a javascript function that uses setInterval to manipulate a string every
I have a static logging function that uses StringBuilder to concatenate a bunch of

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.