Tips on modifying the background color of a read-only field in an edit form

Changing the background color of a readonly field in the edit form of Free jqgrid can be a challenge.

One potential solution involves specifying a style:

.jqgrid-readonlycolumn {
    background-color: #FFFFDD;
}

This style is then used in the colmodel editoptions:

editable: getReadOnlyEditable,
editoptions: { "readonly" : "readonly" , "class" : "grid-decimal-edit jqgrid-readonlycolumn" }


function getReadOnlyEditable(options) {
    if (options.mode === "cell" || options.mode === "add" || options.mode === "edit") {
        return false;
    }
    // form editing
    return "readonly";
}

The jqgrid adds these classes as the first classes:

<td class="DataTD">
<input type="text" readonly="" 
   class="grid-decimal-edit jqgrid-readonlycolumn FormElement
          ui-widget-content ui-corner-all" 
    disabled="disabled" 
    id="Varadokumn" name="Varadokumn" role="textbox"></td>

However, the ui-widget-content class appearing after overrides the background color to white.

An attempted fix involved adding the following style:

body .DataTD .jqgrid-readonlycolumn {background-color: #FFFFDD !important;}

Unfortunately, the background color still appeared as white. Further troubleshooting may be necessary.

Answer №1

Simply include background-image: none to resolve the issue. Here is a suggestion:

.jqgrid-readonlycolumn {
    background-image: none;
    background-color: #FFFFDD;
}

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

Accessing iframe's HTML using a server-side solution by circumventing the Cross-Domain Policy

Our current challenge involves accessing dynamically generated HTML elements using JavaScript, particularly when trying to extract image URLs from these elements. When the HTML elements are generated solely through JavaScript, extracting the URL is straigh ...

Tips for indicating which content to display on template literals

Utilizing template literals to showcase some fetched data, I've successfully displayed all the necessary information on the frontend. However, certain content is hidden and meant to be toggleable. Yet, I'm struggling to figure out how to link eac ...

Design a dynamic card with an eye-catching Font Awesome icon that adapts well to

As I delve into the realm of CSS, my current mission is to replicate the captivating cards showcased on this particular website. Utilizing Font Awesome icons has become a pivotal aspect of this endeavor. For instance, let's take a look at this card:ht ...

Tips for styling a PHP file using CSS and styling more than one element:1. Begin by creating a

I am currently attempting to style a php file using a linked stylesheet, but I am encountering some difficulties. At the moment, I have the , it will affect either the font or the border.</p> Is there a way to apply multiple styles to elements on a ...

"Unable to Access Account: PHP Login Script Failing to Log Users In

I've encountered a login issue with my website script that I can't seem to figure out. The script is designed to log users in after they input their username and password, but for some reason, even with the correct credentials, authentication fai ...

Unable to load the Bootstrap CSS file from the specified import path: "bootstrap/dist/css/bootstrap.min.css"

I am currently working on a React application where I have a page that utilizes components from the react-bootstrap library. The issue I'm facing is related to styling, even though I have already imported the necessary bootstrap CSS file: import "boot ...

Is Jquery compatible with your Wordpress theme?

My current wordpress version is 3.4.1 and I want to include jQuery in my custom wordpress theme. Despite trying multiple solutions found online, I have been unsuccessful in implementing it convincingly. Can someone please provide a simple example to help ...

Creating a Web Form in Outlook Using the POST Method

Seeking help in creating an HTML email featuring two interactive buttons - Approve and Reject. I have successfully generated the HTML email and sent it to Outlook. Snapshot: https://i.sstatic.net/NrGFM.png The HTML code within the email: <!DOCTYPE ...

Synchronizing two navigation menus on a single-page application website

Let me start by saying that I specialize in back end development and am facing a specific challenge with building a website that includes two navigation menus. The main navigation menu features links like Home, while the sub-navigation menu includes option ...

Experience a glint in the React Suspense with React Router - Struggling with CSS properties post utilizing Suspense and Lazy

I'm experiencing an issue with my code where the CSS properties are not working properly when I wrap the code in suspense. The page loads and the suspense functions as expected, but the styling is not being applied. However, if I remove the suspense, ...

Assistance with MVC WebAPI Layout

Can anyone offer guidance on how to customize the layout of automatically generated WebAPI help pages? I am looking to replace @Html.DisplayFor(m => m.SampleResponses, "Samples") with Jquery UI tabs, but I'm having trouble getting it to function p ...

The MVC JQuery Ajax request is not yielding any results, yet there is no error message being returned

Below is my front end request let endpoint = "@Url.Action("Testerosa", "Attendance")"; $.get(endpoint, function(response) { debugger; alert(response); }).fail(function (error) { alert(error); }); This is th ...

Struggling to make the toggle button appear on the bootstrap navbar when shrinking the resolution

Everything seems to be working well with the navbar initially, but when resizing the screen to a smaller resolution, all the navigation items disappear and the "hamburger icon" fails to appear. <nav class="navbar navbar-custom navbar-expand-md fi ...

Implementing real-time data updates on a webpage using Node.js

Currently, I am faced with the challenge of updating values on my page in real-time without the need for constant webpage refreshing. To illustrate, consider a scenario where a user filters a real estate website by location and receives results showing the ...

Tips for creating a customized dropdown menu that opens upwards without relying on Bootstrap

Looking for some assistance with creating an animated dropdown menu that slides upwards. Any help is appreciated! $('.need-help').click(function() { $('.need_help_dropdown').slideToggle(); }); .need-help { background:url(../im ...

Strange behaviors when using setinterval with classes

Currently working on enhancing a slider functionality, and I have observed that everything is functioning smoothly - function Slider(element) { this.i = 0; this.element = element; var self = this; this.timer = window.setInterval(functi ...

Personalizing a class specifically for error messages within the jQuery Validation plugin

When using the jQuery Validate plugin, is it possible to set a separate class for the error message element without affecting the input element's class? ...

ngInfiniteScroll Activates on Every Scroll Occurrence

Implementing ngInfiniteScroll for endless scrolling on my website has required me to set the height of the outer div to a specific value. Without this adjustment, the Infinite Scroll feature activates unintentionally. <div style="height: 1px"> &l ...

jquery selector for elements inside of 'this'

I'm attempting to style the paragraph element within a specific selected element using CSS. I attempted surrounding the 'p' in quotes within the selector, but it did not have any effect. $('#characterSelect div').on('click&ap ...

Countdown Widget - Transform "0 Days" to "Today" with jQuery

I am currently working on a countdown page using the Keith Woods Countdown jQuery plugin which can be found at . Here is the code I have implemented so far: $(document).ready(function () { var segera = new Date(); segera = new Date(segera.getFullYear(), 2 ...