Table or gridview nth-child()

Posted by Rajesh_Kumar under CSS 3 on 7/1/2015 | Points: 10 | Views : 852 | Status : [Member] [MVP] | Replies : 2
Hi All,
Can we pass column name other than column index in nth-child()method?

Rejesh Kumar


Responses

Posted by: Sheonarayan on: 7/2/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
No, nth-child selector accepts only the index of the element from the top of the page, read this at http://techfunda.com/Howto/jquery/155/nth-childn-nth-child.

If you have name/id, you can use below JavaScript function directly

document.getElementsByName("elementName") or document.getElementById("elementId")

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Rajesh_Kumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Purvi on: 8/20/2019 [Member] Starter | Points: 25

Up
0
Down
Hello, Assuming that you already know what is nth-child() and for what it used for.

The :nth-child(n) selector selects all elements that are the nth child
Formula:
nth-child(n)

Here, n The index of each child to match.

Must be a number . The first element has the index number 1, you can not use any non-number or string value as a value of n.

so, we can not pass column name other than column index in nth-child()method.

Rajesh_Kumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response