Server IP : 51.89.169.208 / Your IP : 3.148.107.92 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/yellowleaf/public_html/members/js/ |
Upload File : |
var current_element=1; function addCategory(example_name){ // creating input box var categoryEl = document.createElement('input'); categoryEl.setAttribute('type', 'text'); categoryEl.setAttribute('id', 'category_'+current_element); categoryEl.setAttribute('size', '35'); categoryEl.setAttribute('name', 'category[]'); if(example_name!=''){ categoryEl.setAttribute('value', example_name); categoryEl.setAttribute('style', 'color:#888'); } categoryEl.setAttribute('onblur', 'if(this.value==\'\'||this.value==\''+example_name+'\'){this.value=\''+example_name+'\';this.style.color=\'#888\'};;setTimeout(\'document.getElementById(\\\'category_box_'+current_element+'\\\').style.display=\\\'none\\\'\',10);'); categoryEl.setAttribute('onkeydown', 'return displayunicode(event,'+current_element+');'); categoryEl.setAttribute('onclick', 'if(this.value==\'\'||this.value==\''+example_name+'\'){this.value=\'\';this.style.color=\'#000\';}'); categoryEl.setAttribute('onkeyup', 'showUser(this.value,\''+current_element+'\',event);'); // creatin div container var category_div = document.createElement('div'); category_div.setAttribute('id','cat_'+current_element); category_div.setAttribute('class','cat_cn'); // creatin a element var category_a = document.createElement('a'); category_a.setAttribute('href','javascript:removeCategory('+current_element+')'); // appending all elements category_div.appendChild(categoryEl); category_a.appendChild(document.createTextNode(' remove')); category_div.appendChild(category_a); // appending to all to single element in HTML document.getElementById('category_cn').appendChild(category_div); //increment current element current_element++; } function removeCategory(element_id){ var el=document.getElementById('cat_'+element_id); el.parentNode.removeChild(el); }