I need to access this link <%= link_to "Home", root_path, class: "btn btn-primary" %>
in jquery to disable it in my code.
The link is given in ruby gem due to which I am unable to add class or id to this link.
Is there any way to access this link other than using id or class?
It not difficult to identify element but I will be inconsistent as there might be other elements with similar property.
We can't identify your link based on class as there is no unique class. Similarly for id as well.
If you want to do it with Content you can use it like below
$("a:contains('Home')")
####****To be more specific about identifying your element.#####
If you know where home link redirects,I mean href content. you can do like this.(Assuming root_path is '/home')
$("a:contains('Home')[href='/home']")