You are viewing limited content. For full access, please sign in.

Question

Question

CSS in Table Not Being Applied to All Rows in Firefox

asked on April 8, 2014

We have a field that has a CSS value of read-only applied to it in a table. The first row works correctly, but all rows after that do not. It should mark the field as read only using the following JavaScript:

//make fields with read-only class read-only
  $(".read-only *").prop("readonly", true);

This is what I get though:

 

0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on April 11, 2014

If these rows are added after the form loads (and after your code runs), they won't be affected by your code. Make sure that your code runs when each new row is added to the form. If you're using JavaScript to perform those mileage calculations, the ideal time to make the field read only is right after you've filled it with a value.

0 0

Replies

replied on April 8, 2014 Show version history

Have you tried just using $(".read-only") without the wildcard? Also maybe something like this:

 

$(".read-only").each( function() {
        $(this).prop("readonly", true);
    }
1 0
replied on April 8, 2014

What does the generated HTML look like? Not the Right-Click>View Source HTML, but the stuff that shows up in F12 tools.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.