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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:45:54+00:00 2026-05-14T08:45:54+00:00

I want to get 4 variables when I click on a span that have

  • 0

I want to get 4 variables when I click on a span that have the CSS3 text-shadow propriety. So for a css propriety of text-shadow: -4px 11px 8px rgb(30, 43, 2);, my code should be:

$("#element").click(function () {
var text-shadow = $("#element").css("text-shadow")
});

Would it be possible to get it split like:

var y = "-4px";
var x = "11px";
var blur = "8px";
color = "rgb(30, 43, 2)";

I need to somehow split the first variable to get this data.

Thanx

  • 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-14T08:45:55+00:00Added an answer on May 14, 2026 at 8:45 am

    You should use regular expression to split the result of jQuery css into the variables you are looking for.

    var result = $('#element').css('text-shadow').match(/(-?\d+px)|(rgb\(.+\))/g)
    // result => ['rgb(30, 43, 2)', '-4px', '11px', '8px']
    var color = result[0],
        y = result[1],
        x = result[2],
        blur = result[3];
    

    This will return an array splitting the text-shadow string value into numbers with pixels and rgb values. It can help you in this particular case, but you’ll probably need to work on it some more to get it working for all the possible cases of text-shadow

    NOTE: The rgb(...) value is the first match in the array because, that is the way Firefox, Chrome, Safari and Opera return it, independently of how you assign it. IE might do it differently.

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

Sidebar

Related Questions

I want to get the text of the button whenever I click on it.
I want get all of the Geom objects that are related to a certain
I want to get my databases under version control. I'll always want to have
I want to get an overview of files that are updated in TFS (that
Very simple problem: I have a Public Sub (in a module) that I want
<div class=Name> <div class=Image></div> <ul> <li><h5><span classmyName>I want this text</span></h5></li> <li class=description>The description</li> </ul>
I have a pause screen that is being added when you click the pause
I am using a Django Paginator and I want to have multiple available get
I have a inline list of pictures that I want to be able to
In a bash script, I want to get the cursor column in a variable.

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.