I have a hidden field, which has the following markup:
<input type="hidden" name="ctl00$ContentPlaceHolder1$LinksOverview1$ProductView$ctrl1$ctl01$ctl00$DescriptionOfLink$QuestionDivInfo" id="ContentPlaceHolder1_LinksOverview1_ProductView_ctrl1_ctl00_3_DescriptionOfLink_3_QuestionDivInfo_3" value="ContentPlaceHolder1_LinksOverview1_ProductView_ctrl1_ctl00_3_questionMark_3" />
The value of my hidden field, is the same as the ID of a span i have:
<span id="ContentPlaceHolder1_LinksOverview1_ProductView_ctrl1_ctl00_3_questionMark_3" class="questionMarkLayout">(?)</span>
I dont know the ID of my span before the code is rendered, but I can access the value of my hidden field.
Using jQuery, I want to:
- Grap the control, with the ID of the value of my hiddenfield
So far I’ve tried:
<script type="text/javascript">
$(document).ready(function () {
alert('<%#QuestionDivInfo.ClientID %>');
$('<%#QuestionDivInfo.ClientID %>').val().mouseover(function (e) {
$('<%#HintDiv.ClientID %>').show();
});
$('<%#QuestionDivInfo.ClientID %>').val().mouseleave(function (e) {
$('<%#HintDiv.ClientID %>').hide();
});
});
</script>
But it doesn’t work.
Any hints? 🙂
Use this code: