#29750 progress bar initial page created.
[com.zyxware.civiwci.git] / addmore.js
1 // Updated to wait until the document is loaded. addmore_link
2
3 jQuery(document).ready(function () {
4 // var text = jQuery('h1').text();
5 // alert(text);
6
7 });
8
9 cj(function ( $ ) {
10
11 // var text = jQuery('h1').text();
12 // alert(text);
13
14 $('#addmore_link').on('click', function( e ) {
15 e.preventDefault();
16 // $('#addmore_link').click(function () {
17 var count = parseInt($('input[name=contrib_count]').val());
18 count++;
19
20 //$('#myDiv').append('<input type="text" id="p_scnt" size="20" name="p_scnt_' + count +'" value="" placeholder="Input Value" /><br>');
21
22 //$('#myDiv').append('<select id=\"selectId\" name=\"selectName\" />');
23 // $('select[name=contribution_page_1]').parent('div').append('<select name="selectName" />');
24 // var contr_name = "contribution_page_" + count.toString();
25 //$('input[name=percentage_1]').parent('div').parent('div').parent('div').append('<label>Contribution page</label>');
26 // $('#crm-container').append('<label>Contribution page</label>');
27
28 var c_page = $('select[name=contribution_page_1]').clone().attr('id', 'choices_' + $(this).index());
29 c_page.attr("id", "contribution_page_" + count);
30 c_page.attr("name", "contribution_page_" + count);
31 //.insertAfter("select[name=contribution_page_1]");
32
33
34 $('input[name=percentage_1]').parent().parent().append("<br>")
35 $('input[name=percentage_1]').parent().parent().append(c_page);
36 // $('input[name=percentage_1]').parent('div').append('<br><select name="contribution_page_' + count +'" />');
37
38 $('input[name=percentage_1]').parent().parent().append('<br><input type="text" size="20" name="percentage_' + count +'" value="" />');
39 // $('input[name=contribution_page_' + count + ']').text($('input[name=contribution_page_1]').text());
40
41 $('input[name=percentage_1]').parent().parent().append('<a id="#remove_link" href="test" > Remove</a>');
42
43 $('input[name=contrib_count]').val(count);
44 alert(count);
45 //alert(contr_sel);
46 //alert($('input[name=contrib_count]').val());
47 //alert($('select[name=contribution_page]').val());
48 //alert($("select[name=contribution_page] option:selected").text());
49 //alert($("#count").val());
50 //$('select[name=contribution_page]').
51
52
53 });
54
55 $('#remove_link').on('click', function( e ) {
56 e.preventDefault();
57 alert("hi");
58 })
59 /*
60 $(function() {
61 var scntDiv = $('#p_scents');
62 var i = $('#p_scents p').size() + 1;
63
64 $('#addmore_link').live('click', function() {
65 $('<p><label for="p_scnts"><input type="text" id="p_scnt" size="20" name="p_scnt_' + i +'" value="" placeholder="Input Value" /></label> <a href="#" id="remScnt">Remove</a></p>').appendTo(scntDiv);
66 i++;
67 return false;
68 });
69 */
70
71 });