Expanding JQuery Mobile Grouped Button Width to Fit Entire DIV on Window Resize

Struggling to make these buttons resize dynamically with the page to completely fill the DIV (33% each).

I've tried adjusting the width, but it's not perfect and looks worse as the page gets wider. Setting the width to 33% makes them too narrow.

Is there a more effective approach?

JQuery code for $(window).resize event:

var myWidth = $(window).width() - 1.3*($(window).width() - $('#eventForm').width());
$('.eStatusLabel').css("width", myWidth/3);

Here is the HTML markup :

<div class="ui-block-b" id="statusDiv" >
    <fieldset data-role="controlgroup" data-mini="true" data-type="horizontal" >
        <input type="radio" name="rdStatus" id="eventStatus1" value="yes" />
        <label class="eStatusLabel" for="eventStatus1" >Yes</label>
        <input type="radio" name="rdStatus" id="eventStatus2" value="maybe" />
        <label class="eStatusLabel" for="eventStatus2" >Tentative</label>
        <input type="radio" name="rdStatus" id="eventStatus3" value="no" />
        <label class="eStatusLabel" for="eventStatus3" >No</label>
     </fieldset>
</div>

Answer №1

Adjust the width of the element with class 'eStatusLabel' to be one-third of the width of the element with id 'statusDiv', minus 1 pixel.

This code snippet is recommended for achieving this task.

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

The content of btn-id element in Angular is showing as undefined

I have a JavaScript file located at sample/scripts/sample.js and there are 8 HTML files in the directory sample/src/templates/. My goal is to select a button on one of the HTML files. When I tried using angular.elemnt(btn-id).html(), I received an 'un ...

Error in hover feature not performing to expectations

Check out my jsfiddle link: http://jsfiddle.net/ganganp/x62wR/5/ $('#rotator0 div').hover( function () { ssrc = $(this).find('img').attr("src"); valt = $(this).find('img').attr("alt"); ...

Learn the best method for accessing and utilizing an existing file effortlessly

As a newcomer to PHP, I have successfully learned how to upload a file from a list using the following code: var file = e.target.files[0]; alert(file); This code returns an [object File], indicating that the file has been uploaded. Now, my question is: ...

Replacing a DOM Element on Page Load using jQuery

I am looking to substitute the following HTML element: <input type="submit" id="send_product_enquiry" value="Send Enquiry" class="button"> with this updated version: <input type="submit" id="send_product_enquiry" onclick="ga('send', & ...

Transform a text node into an HTML element with the help of JQuery

Consider this HTML snippet: <div> Lorem ipsum <span>dolor sit</span> amet <span>consectetur adipiscing elit</span> eiusmod tempor </div> To select the text nodes [Lorem ipsum, amet, eiusmod tempor], ...

Designing personalized sass components

Seeking advice on developing a custom CSS unit that can be utilized in Sass with Node.js. Is there a tutorial available for creating a Sass plugin specifically for this purpose? For instance, I am looking to establish a unit called "dpx" which functions as ...

Using a jQuery AJAX request to update the quantity of available items based on user input

Is there a way to use jQuery to capture user input values and product value, then send it to the backend? I need this to trigger an AJAX call that will hit a Java backend. The goal is to provide a product number and quantity value in order to generate th ...

Ways to style specific dates on a datepicker?

Is there a way to customize the appearance of the first and last selected days in my ui datepicker for booking, similar to the design shown in the image linked below? https://i.sstatic.net/bKnRS.jpg var dateFormat = "DD/MM/YY", ...

Having trouble getting the Boostrap 4 modal to function properly in asp.net?

Struggling to incorporate a Bootstrap 4 modal popup into my ASP.NET page without triggering a postback. I've tried various suggestions like placing the modal code outside of the form tag or using an update panel, but nothing seems to work. Interesting ...

Leverage AngularJS to dynamically load CSS stylesheets using ng-repeat

I have organized my stylesheets into separate modules for each include, and I am trying to dynamically load them. However, I am facing some difficulties as when they are rendered, all I see is the following markup for each sheet that should be loaded: < ...

What is the method for displaying text and icons as black in a sticky header design?

Having trouble making the menu text and icons in the sticky header black on my website. I've been searching for the correct class in the CSS styles, but haven't been able to find it. I tried using this CSS: .header-wrapper .stuck { color: #000 ...

in tailwind, the position transition does not work as expected

I have a React component that I'm working on: function DivModal() { const [isOpen, setIsOpen] = useState(true) return ( <div> <button onClick={() => setIsOpen(prev => !prev)} className={buttonStyle}>Open</button> ...

Is there a way to toggle the visibility of the angular material toolbar at regular intervals?

I'm currently experimenting with the CSS animation feature to display and conceal the angular material toolbar in this demonstration. Inside the application component, the hide attribute is toggled at intervals as shown below: hide:boolean = false ...

Interact with gridview rows using jQuery on the main page

I've been exploring ways to make it possible for the user to click on a row within a gridview in a master page. My ultimate goal is to redirect the user to another page while passing along values from the gridview (specifically from the hiddenfield co ...

What are the best scenarios for implementing jQuery-ui plugin as opposed to Backbone View?

I am feeling uncertain about the concept of "componentization" in web UI development. When I need a component, should I develop my own jQuery-UI plugin or opt for creating a MarionetteComponent if I am using Backbone.Marionette? Both options provide reusa ...

Retrieving JSON data without using Jquery's Ajax function

I was wondering if there is any way to retrieve the results of a jQuery AJAX call and store them in a traditional variable for use as a function. Here's an example: function getPoints(){ //An array of JSON objects var Points; ...

The dynamic loading of select tag options in Vue.js is not rendering properly

I'm having trouble displaying a select tag with options loaded from a Vue object. However, when I try to render it, something seems off: https://i.sstatic.net/odbC6.png Here is the HTML markup for the select tag: <div class="form-group ui-model" ...

Having trouble with submitting the code - need help resolving the issue

I'm facing an issue with my submit cancel code. The JavaScript code I implemented for preventing the submission function on my page isn't working as expected. While it does work to a certain extent, it's not fully functional. I am seeking a ...

Handling Ajax errors in jQuery with MVC 3

I'm currently working on a code snippet that involves opening a dialog with a specific View. $('.bulkEditlink').click(function () { var f = $('td:first', $(this).parents('tr')).text(); var r = tableCols().toStrin ...

The value entered is displaying as not defined

As a newcomer to the world of javascript, I am diving into creating a simple To Do list. The basic functionality is there, but I'm scratching my head trying to figure out why the input value in my code keeps returning undefined. The remove button is ...