-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
30 lines (26 loc) · 1.17 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$(document).ready(function(){
$(".nav-tabs > li.active").removeClass("active");
//hdhh
$(".nav-tabs").on("click", "a", function (e) {
e.preventDefault();
if (!$(this).hasClass('add-contact')) {
$(this).tab('show');
}
})
.on("click", "span", function () {
var anchor = $(this).siblings('a');
$(anchor.attr('href')).remove();
$(this).parent().remove();
$(".nav-tabs li").children('a').first().click();
});
$('.add-contact').click(function (e) {
e.preventDefault();
var idi = $(".nav-tabs").children().length;
var tabId = 'contact_' + idi;
$(this).closest('li').before('<li class="newtab"><a href="#contact_' + idi + '">SECTION ' + idi + '</a> <span><i class="fa fa-close"></i></span></li>');
//$('.tab-content').append('<div class="tab-pane" id="' + tabId + '">Contact Form: New Contact ' + id + '</div>');
$('.tab-content').append('<div class="tab-pane" id="' + tabId + '"><form><textarea name="editor' + idi +'" id="editor'+ idi + '" rows="10" cols="80"></textarea></form></div>');
$('.nav-tabs li:nth-child(' + idi + ') a').click();
CKEDITOR.replace('editor' + idi);
});
});