There are some radio buttons inside my asp.net
wizard control.
For better understanding Markup:
<asp:Wizard ID="WizardCreateDL" runat="server" ActiveStepIndex="0" BackColor="#F7F6F3"
BorderColor="#CCCCCC" BorderWidth="1px" Font-Names="Calibri" Font-Size="0.8em"
Height="337px" Width="800px" OnNextButtonClick="WizardCreateDL_NextButtonClick"
OnCancelButtonClick="WizardCreateDL_CancelButtonClick" OnPreviousButtonClick="WizardCreateDL_PreviousButtonClick"
DisplaySideBar="False" BorderStyle="Solid" OnFinishButtonClick="WizardCreateDL_FinishButtonClick">
<StepStyle BorderWidth="0px" />
<WizardSteps>
<asp:WizardStep ID="stepCreateFolder" runat="server" Title="FolderOptions" >
<div id="dvFolderOptions" runat="server" style="text-align: left; width: 45%; margin: auto; font-size:medium">
<ul style="list-style: none;">
<li>
<input type="radio" id="rdbCalendar" value="0" name="Cal" onclick="appendChild(this);" /><label for="rdbCalendr">Calendar</label></li><br />
<li>
<input type="radio" id="rdbTasks" value="0" name="Cal" onclick="appendChild(this);" /><label for="rdbTasks">Tasks</label></li><br />
<li>
<input type="radio" id="rdbContacts" value="0" name="Cal" onclick="appendChild(this);" /><label for="rdbContacts">Contacts</label></li>
</ul>
</div>
</asp:WizardStep>
</WizardSteps>
<StartNavigationTemplate>
<asp:Button ID="StepNextButton" runat="server" CausesValidation="False" CommandName="MoveNext"
Font-Names="Calibri" Font-Size="1.3em" Text="Next" Visible="false" />
<asp:Button ID="btnFinish" runat="server" Font-Names="Calibri" Font-Size="1.3em"
Text="Finish" Visible="false" CausesValidation="False" OnClick="btnFinish_Click" />
</StartNavigationTemplate>
</asp:Wizard>
The js event:
function appendChild(crnt) {
alert('hi');
var parentLi = $(crnt).parents('li:first');
if (parentLi.find('ul:first').length == 0) {
var Container = $('<ul></ul>').append('<li><input type="radio" id="rdbEditor" value="0" onclick="secondLevelChild();" /><label for="rdbEditor">Editor</label></li><li><input type="radio" id="rdbReviewer" value="0" onclick="secondLevelChild();" /><label for="rdbReviewer">Reviewer</label></li>')
parentLi.html(Container);
}
}
i have been struggling to fire this event , tried also possible ways to do this like :
$(function () {
$('#ContentPlaceHolder1_WizardCreateDL_dvFolderOptions').find('li').each(function () {
$(this).find('input:radio').click(function () {
appendChild(this);
alert('1+2+3');
});
});
});
but it is just not ready to fire, any help??
我尝试代码,似乎“ appendChild”是内置的js函数,给我带来了错误,因此当我将其名称更改为“ appendChild1”之类的其他东西时,它可以正常工作,请尝试一下...
Can you try below code
$('#<%=dvFolderOptions.ClientID %> li input:radio').click(function()
{
appendChild(this);
}
Change your function name appendChild to any other name becoz appendChild is already present in javascript
change This
function appendChild(crnt) {
// code goes here
}
To
function appendMyChild(crnt) {
// code goes here
}
Try this
$('[id$=dvFolderOptions]').delegate('li input:radio', 'click', function(){
appendChild(this);
alert('1+2+3');
});
Use this
$('#<%=dvFolderOptions.ClientID %>').find('li').each(function () {
instead of
$('#ContentPlaceHolder1_WizardCreateDL_dvFolderOptions').find('li').each(function () {
I just tested and it works!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.