Changing the size of text using radio buttons in JQuery MobileIs there a way to modify

I am currently working on adjusting the text size for both header and paragraph information in a listview. Below is the JQuery code that I have implemented:

$('#rc1').prop('checked', 'true', function(){
    $(".feedContainer ul li h3").css('font-size', '1em');
    $(".feedContainer ul li p").css('font-size', '.9em');

});

$('#rc2').prop('checked', 'true', function(){
    $(".feedContainer ul li h3").css('font-size', '1.5em');
    $(".feedContainer ul li p").css('font-size', '1.4em');
    $('#header-title').html('test');

});

$('#rc3').prop('checked', 'true', function(){
    $(".feedContainer ul li h3").css('font-size', '2em');
    $(".feedContainer ul li p").css('font-size', '1.9em');

});

Here is the html code snippet provided:

 <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
        <legend>Text Size</legend>
        <input type="radio" name="rc1" id="rc1" value="off" >
        <label for="rc1">A</label>
        <input type="radio" name="rc2" id="rc2" value="off">
        <label for="rc2">A</label>
        <input type="radio" name="rc3" id="rc3" value="off">
        <label for="rc3">A</label>
 </fieldset>

Furthermore, below is the CSS code governing the font size of the letter "A" in the radio button group (which appears to not be functioning as expected):

#rc1 {
    font-size: 12px;
}

#rc2 {
    font-size: 16px;
}

#rc3 {
    font-size: 24px;
}

If anyone could assist me with this issue, I would greatly appreciate it. Thank you!

Edit: Included additional CSS styling for feedContainer:

.feedContainer ul li h3 {
    color: #333;
    font-size: 1em;
    padding: 0;
    font-weight: bold;
    margin: 0;
    font-family: 'Oxygen', sans-serif;
    white-space:normal;
}
.feedContainer ul li p {
    font-size: .9em;
    color: #666;
    margin: 0;
    font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
    white-space:normal;
}

Answer №1

When using the jQuery .class selector, it selects all elements with the specified classname, such as .class. Give it a try and see what the variable is.

 var color = $("div").css( "background-color" );
    

Is .feedContainer considered an element?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Every other attempt at an Ajax request seems to be successful

I'm new to using ajax and I'm having an issue with submitting a form through a post request. Strangely, the code I wrote only works every other time. The first time I submit the form, it goes through ajax successfully. However, on the second subm ...

Angular CLI may not always detect newly added tests without manual intervention

When initiating an Angular-cli test using ng test only the already defined tests are executed. Any addition or deletion of a test is not automatically detected (i.e. the test count remains the same). Restarting the command refreshes the current test suit ...

Trouble with partial page displaying incorrect CSS class

I have created CSS classes for generating circles with different colors. When I apply the CSS class in a regular HTML file, it displays correctly as expected. However, when I try to use it in an AngularJS partial page, the circle does not render properly. ...

Protecting String in PHP to Utilize in JavaScript

When I receive code through AJAX, I handle it as shown below: $verifiedSubject = addslashes(htmlentities($_REQUEST['subject'])); $verifiedBody = addslashes(htmlentities($_REQUEST['body'])); $verifiedAttachment1 = addslashes(htmlentitie ...

Find a way to sift through an array of objects to ensure that each object is distinct from the others

Here is an array where objects with the same values for st and ct should be considered identical. For example, the first and third objects have the same values for st and ct, so the third object should be filtered out of the final array. How can I achiev ...

.mounted middleware's redirect() function fails when using a relative destination

I need to limit access to a specific subtree only to users who have been authenticated. The setup looks like this: app.use(express.bodyParser()) .use(express.cookieParser('MY SECRET')) .use(express.cookieSession()) .use('/admin', is ...

Differences between React class properties and ES6 class properties

With React 16.2, defining class properties is done differently with the tagLine example shown below: class Header extends React.Component { tagLine = "Super Hero"; render() { .... } } Contrastingly, in ES6 classes, it's not possible to define ...

Automatically submitting files upon submission - Leveraging PHP and Ajax

I am attempting to automatically submit the form once a file is selected. I am aware that this question has been asked on StackOverflow before, but the solutions provided did not resolve my issue. <form id="img-compressor-form"> <input t ...

Experiencing difficulties with updating populated inputs that are connected to fetched data as they are not reflecting changes when modified

I am currently facing challenges with handling text fields in my web application. I need to retrieve data from the database, populate it in the appropriate fields, allow users to edit the information, and save any changes made. However, I have encountered ...

Unable to locate module specifier three

Currently, I am working on Three.js in three different modules and using Express as the backend server. In my console, I keep encountering the error: "Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with eith ...

Can JavaScript functions be automated on a web browser using Power BI tables?

I am facing a challenge with saving data from a powerbi table on a daily basis. When I hover over the table and click on the ellipsis menu, a button element is generated in HTML that allows me to save the data to a CSV file using Selenium. However, achiev ...

Is it considered best practice to call the same function within itself in a function?

function takeANumber() { let startHealth = parseInt(prompt("Please enter a positive number:")); // I am recursively calling the same function within an if block to ensure that the input is a valid number greater than zero. Is this considered good practic ...

Challenges with the final child element's CSS styling

Hey everyone, I've recently added the following CSS: #tab-navigation ul li:last-child { background-image: url(../images/tabs-end.gif); background-repeat: no-repeat; color: #fff; display: block; border: 1px solid red; backgrou ...

Setting the [required] attribute dynamically on mat-select in Angular 6

I'm working on an Angular v6 app where I need to display a drop-down and make it required based on a boolean value that is set by a checkbox. Here's a snippet of the template code (initially, includeModelVersion is set to false): <mat-checkbo ...

Creating functional links with card-img-overlay in Bootstrap v4

Encountering an issue where Bootstrap v4 cards utilizing card-img-overlay to overlay text on an image are causing links below the image to become unresponsive. The following links are functional: <div class="card" style="border-color: #333;"> & ...

Fixing TypeError in React App: How to Resolve the "Cannot read property 'prototype' of undefined" Issue

I am completely new to JavaScript and I am struggling to understand the error that keeps popping up. After doing some research, it seems like the error could be due to a poorly written function or something along those lines. Here are the classes involved ...

What is the best way to apply a JQuery UI Tooltip to a newly added element?

In my HTML file, I have included all the necessary JS and CSS files. Then I load a content page within it. Some of these content pages contain Usernames where I want to implement a tooltip feature. Here is an example of how they are structured: <user ...

Triggering the onChangeMonthYear() event manually for jQuery datepicker

Currently, I am working with this function: $('#picker').datepicker({ // ... onSelect: function(currDate){ } }); I would like to manually trigger the onSelect() function, but using $('#picker').datepicker.onSelect(); does ...

Unable to provide any input while utilizing npm prompts

After installing npm prompts, I encountered a strange issue. When trying to run the example code for npm prompts, I found that I couldn't enter any input at all. The underscore in the input field would blink for a few seconds, then the cursor would ju ...

Troubleshooting Problems with POST Requests in ExpressJS

Currently, I am working on developing a feature in NodeJS that allows users to upload files. However, I am encountering difficulties while attempting to make a simple POST request. In my index.ejs file, I have written code that generates a form and initia ...