Techsavy
asked on
CSS help
Hi,
I need some help with a CSS selector to hide a particular element. Please see my html below. What I would like to do ideally is to hide the second td element of the tr with id = OriginalCopyRightsIncluded ~Disable. so , in this case, I want hide the text "yes". Can anyone help me with the css for this? please note that I dont want to hide every single element that has "ms-formbody as the class.
I need some help with a CSS selector to hide a particular element. Please see my html below. What I would like to do ideally is to hide the second td element of the tr with id = OriginalCopyRightsIncluded
<tr id="OriginalCopyRightsIncluded~Disable" unselectable="off">
<td class="ms-formlabel" nowrap="true" valign="top" style="width: 363px; white-space: nowrap;">
<h3 class="ms-standardheader" id="OriginalCopyRightsIncluded">
<nobr>C-Original copyright notices requirement</nobr>
</h3>
</td>
<td class="ms-formbody" valign="top">Yes</td>
</tr>
Please help.
ASKER
Hi Brandon,
Thank you. But unfortunately, it didn't work.
Thank you. But unfortunately, it didn't work.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Brandon,
That it the Id that I am seeing in the browser when I inspect the element.
Are we missing any syntax in the selector?
That it the Id that I am seeing in the browser when I inspect the element.
Are we missing any syntax in the selector?
It would be easiest to troubleshoot if we had access to the page. As it is I'm recommending fixes based on speculation. You can see from the link I provided that if we use the ~ then the selector will not work because that ID is not valid markup (see this link for more details on what are valid ID names)
ASKER
Ok, if I remove the Disable on the field property, this is what I see in the HTML: Now, I need to hide the "select" element which is the dropdown control I am trying to hide.
The element that I like to hide is the select element with the title C-Original copyright notices requirement
Thank you for your help.
The element that I like to hide is the select element with the title C-Original copyright notices requirement
<tr id="OriginalCopyRightsIncluded~Show" unselectable="off">
<td class="ms-formlabel" nowrap="true" valign="top" style="width: 421px; white-space: nowrap;">
<h3 class="ms-standardheader" id="OriginalCopyRightsIncluded">
<nobr>C-Original copyright notices requirement</nobr>
</h3>
</td>
<td class="ms-formbody" valign="top">
<span dir="none">
<select title="C-Original copyright notices requirement" class="ms-RadioText" id="OriginalCopyRightsIncluded_80a21860-7b76-4b23-9c49-72316eaf7f40_$DropDownChoice">
<option selected="selected" value="Yes">Yes</option><option value="No">No</option>
<option value="N/A">N/A</option>
</select>
<br>
</span>
</td>
</tr>
Thank you for your help.
The disable is not the issue. The tilde character ~ is the issue. You will also run into similar issues with the $ sign inside of the select ID.
ASKER
Not sure how to get rid of those characters. Those are being generated by server controls. I can only work on the html that is being rendered on the page.
ASKER
Can we use "title" attribute on the select element to hide the select element?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very nice..Thank you. This worked perfectly.
Code tags added @Techsavy - code tags make your post easier to read and refer to. To add code tags highlight your code snippet and click the CODE Button in the toolbar.
It also helps to format your code nicely so that it is easy to read - I have done both for you in the above posts.
Just for interest (no points please) here are some other styles that will achieve the above
It also helps to format your code nicely so that it is easy to read - I have done both for you in the above posts.
Just for interest (no points please) here are some other styles that will achieve the above
tr[id^="OriginalCopyRightsIncluded"] td span[dir="none"] {
display: none;
}
tr[id^="OriginalCopyRightsIncluded"] td span[dir="none"] select {
display: none;
}
tr[id^="OriginalCopyRightsIncluded"] td:last-child select {
display: none;
}
Edit and if you need to keep the ~ in the name then you could use this #OriginalCopyRightsIncluded\~Show td:last-child select {
display: none;
}
The author was provided with a satisfactory solution.
Open in new window