Reputation: 301
I want to set the id
of the tr
that is the result of the tag liferay-ui:search-container-row
, how can I do it?
For Example, the resulting table row is:
<tr id="aui_3_4_0_1_350" class="portlet-section-header results-header">
I want to attach some javascript for the resulting table and I need something to refer to the various table row, like id="aui_3_4_0_1_350"
.
I could also use the class selector
, but I don't know how to set it.
Upvotes: 2
Views: 1040
Reputation: 586
It is not posible to set a customized id value to a search-container-row. Because they get generated based on the input list and Ids need to be unique. However you can access it using a selector starting with the search-container itself. It depends on what you are trying to accomplish.
If you're using jQuery or similar it should be easy since there's a good variety of them: https://api.jquery.com/category/selectors/
Upvotes: 1
Reputation: 141
If you want to give an element an id you should do it with setAttribute
For example, you first need to get a reference to the element that you want to give the id, with:
var id = document.querySelector("p").setAttribute("id", "idName");
if this is what you're looking for.
Upvotes: 0