change number of elements color

Roi

I have table in this format:

<tr>
  <td><span></span></td>
  <td><span></span></td>
  <td><span></span></td>
</tr>

<tr>
  <td><span></span></td>
  <td><span></span></td>
  <td><span></span></td>
</tr>

when click on some SPAN i would like that all the spans inside the specific TR will get grey color.

how can I do that?

element.parent("tr").children("span").attr('style', 'color: #838282 !important');
Pranav C Balan

span is not direct child so you need to use find() and tr is parent of td not parent of span so use closest(). For applying style use css(), also there is no need of !important in css().

$('tr span').click(function(){
    $(this).closest("tr").find("span").css('color', '#838282');
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Change background color elements in the array

From Dev

match and change color of html elements using regex

From Dev

How do I change the color of the MFMessageComposeViewController elements?

From Dev

Can't change bootstrap theme elements color

From Dev

Change the color of legend elements in ggplot (R)

From Dev

How to change color of elements with angular.js

From Dev

Change the background-color of alternate elements css

From Dev

how to change the text color when checking on elements

From Dev

How to permanently change the color of some elements?

From Dev

How to change the color of Kendo Grid elements

From Dev

How to change the color of two elements using javascript?

From Dev

change background color if elements are empty with jquery

From Dev

Change color from more elements then one in Javascript?

From Dev

how to change the color RatingBar depending on the number of stars?

From Dev

Highcharts change crosshairs color by number of visible series

From Dev

How to change placeholder color for number input? (Firefox)

From Dev

How to change the color of the number if the value decrease or increase?

From Dev

Change background color of highest number in a table

From Dev

Change day number color on click - not background

From Dev

Change background color of highest number in a table

From Dev

Change the number of color depends on which is hovered

From Dev

How to change placeholder color for number input? (Firefox)

From Dev

Find number of consecutive elements that are the same before they change

From Dev

Change position of an exact number of elements in an array

From Dev

How can I change the background color of elements when they're clicked?

From Dev

change the background-color of multiple elements with setInterval and arrays in jQuery

From Dev

How can I change the background color of elements when they're clicked?

From Dev

How to Get Multiple elements to change color on hover CSS?

From Dev

Is it possible to change the select color for form elements like a multiple select?

Related Related

  1. 1

    Change background color elements in the array

  2. 2

    match and change color of html elements using regex

  3. 3

    How do I change the color of the MFMessageComposeViewController elements?

  4. 4

    Can't change bootstrap theme elements color

  5. 5

    Change the color of legend elements in ggplot (R)

  6. 6

    How to change color of elements with angular.js

  7. 7

    Change the background-color of alternate elements css

  8. 8

    how to change the text color when checking on elements

  9. 9

    How to permanently change the color of some elements?

  10. 10

    How to change the color of Kendo Grid elements

  11. 11

    How to change the color of two elements using javascript?

  12. 12

    change background color if elements are empty with jquery

  13. 13

    Change color from more elements then one in Javascript?

  14. 14

    how to change the color RatingBar depending on the number of stars?

  15. 15

    Highcharts change crosshairs color by number of visible series

  16. 16

    How to change placeholder color for number input? (Firefox)

  17. 17

    How to change the color of the number if the value decrease or increase?

  18. 18

    Change background color of highest number in a table

  19. 19

    Change day number color on click - not background

  20. 20

    Change background color of highest number in a table

  21. 21

    Change the number of color depends on which is hovered

  22. 22

    How to change placeholder color for number input? (Firefox)

  23. 23

    Find number of consecutive elements that are the same before they change

  24. 24

    Change position of an exact number of elements in an array

  25. 25

    How can I change the background color of elements when they're clicked?

  26. 26

    change the background-color of multiple elements with setInterval and arrays in jQuery

  27. 27

    How can I change the background color of elements when they're clicked?

  28. 28

    How to Get Multiple elements to change color on hover CSS?

  29. 29

    Is it possible to change the select color for form elements like a multiple select?

HotTag

Archive