Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi friends, thanks for your time.

Actually im creating whole div dynamically, inside the div have radio, select, textarea.

if i click button div will create dynamically(with controls), my problem is when i create div inside that div, if i click radio button i need to disbaled select option.

in this process need to continue if again i click button.

below my code,Radio id(Rfacet), select id(SFacet).

javascript
============
JavaScript
<script type="text/javascript">
$(document).on('click', "#addlink", function() {
var input = $('#aa');
    input.val(parseFloat(input.val()) + 1);

var randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
var uniqid = randLetter + Date.now();
var totaloptiondivs = document.getElementsByClassName("optiondiv");
var optioncount = parseInt(totaloptiondivs.length + 65);
var optionletter = String.fromCharCode(optioncount);
for(var i=0, n=totaloptiondivs.length;i<n;i++) {
for(var x=0, m=totaloptiondivs[i].childNodes.length;x<m;x++) {
if (totaloptiondivs[i].childNodes[x].className == "span1") {
totaloptiondivs[i].childNodes[x].innerHTML = String.fromCharCode(parseInt(65 + i)) + " :";
}
}
}
var newtext1 = "<div class='optiondiv span12' id='sample5'><div class='span1' style='margin-removed22px'>";
var newtext2 = " :</div><br><div class='span8'><input ><br><textarea class='input-xxlarge' id='";

var newtext3 = "'></textarea><br>
<select id='Sfacet' style='width:540px; margin-top:0px'><option value='1'>Select Facet</option><option value='2'>01. The student determines distance ny adding two or more positions during the motion.</option>
<option value='3'>02. The student does not distinguish position and/or distance from speed.</option>
<option value='4'>03. The student views a position or speed graph as a map of the actual motion.
</option>
</select>
</div>
<div class='span3' style='margin-removed270px'><a href='#x' id='removelink'>Remove</a></div></div>";

$("#addoptionshere").append(newtext1 + optionletter + newtext2 + uniqid + newtext3);
tinymce.EditorManager.execCommand('mceAddEditor', true, uniqid);
});
</script>



thanks friends
:)
Posted
Updated 25-Sep-14 19:54pm
v2
Comments
[no name] 25-Sep-14 23:07pm    
you should format the code properly to increase user readability.
Thanks :)
Renga.g 26-Sep-14 1:55am    
pls find above my updated code
[no name] 26-Sep-14 1:17am    
Please format your code once. Its kinda unreadable :(
Renga.g 26-Sep-14 1:55am    
pls find above my updated code
I can't see any Radio Button inside that dynamically created div.

1 solution

See the Demo - [Issue] Disabling DropDownList on RadioButton Click[^]

I have added one RadioButton inside the Dynamic Controls. See if you wanted this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900