I am trying to use Javascript to click on the selection below.
<div class="CRControllerAddButton">
<u colspan="2">Add Access Time</u>
</div>
And i am trying to use document.getElementById('CRControllerAddButton').click();
How come i cant get it to work? Is it because its a class? I just need to click on the div is all at least to work.
What javascript would be used in lets say console on chrome to do this?
Below is the entire code if needed where its nested.
<div id="CRbodyaccesspolicyid" layer="0" class="CRController_body" style="width: 360px; top: 444px; left: 469px;">
<div style="width:100%;background:#FFF;" align="center">
<input type="text" class="CRsearchtext" id="CRSearchTextaccesspolicyid">
</div>
<div id="CRControllerDataaccesspolicyid" style="overflow: auto; height: 61px;">
<table style="width: 100%;">
<tbody>
<tr>
<td colspan="2"><div class="CRControllerAddButton"><u colspan="2">Add Access Time</u></div></td>
</tr>
<tr>
<td title="Allowed all the time" style="width: 50%;"><input type="radio" id="chkaccesspolicyid_1" name="radioaccesspolicyid" key="1" label="Allowed all the time" style="float: left;">
<div style="overflow: hidden; width: 134px; white-space: nowrap; padding-top: 2px; text-overflow: ellipsis;">Allowed all the time</div></td>
<td title="Denied all the time" style="width: 50%;"><input type="radio" id="chkaccesspolicyid_2" name="radioaccesspolicyid" key="2" label="Denied all the time" style="float: left;">
<div style="overflow: hidden; width: 134px; white-space: nowrap; padding-top: 2px; text-overflow: ellipsis;">Denied all the time</div></td>
</tr>
<tr>
<td title="Allowed only during Work Hours" style="width: 50%;"><input type="radio" id="chkaccesspolicyid_3" name="radioaccesspolicyid" key="3" label="Allowed only during Work Hours" style="float: left;">
<div style="overflow: hidden; width: 134px; white-space: nowrap; padding-top: 2px; text-overflow: ellipsis;">Allowed only during Work Hours</div></td>
<td title="Denied during Work hours" style="width: 50%;"><input type="radio" id="chkaccesspolicyid_4" name="radioaccesspolicyid" key="4" label="Denied during Work hours" style="float: left;">
<div style="overflow: hidden; width: 134px; white-space: nowrap; padding-top: 2px; text-overflow: ellipsis;">Denied during Work hours</div></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div id="CRControllerButtonaccesspolicyid" align="center">
<input type="button" class="inputbutton" value="<<" style="display: none;">
<input type="button" class="inputbutton" value="<" style="display: none;">
<input type="button" class="inputbutton" value="OK">
<input type="button" class="inputbutton" value="Cancel">
<input type="button" class="inputbutton" value=">" style="display: none;">
<input type="button" class="inputbutton" value=">>" style="display: none;">
</div>
</div>
idmatching "CRControllerAddButton" and as a result you attempt to clickundefined.