📜 ⬆️ ⬇️

TAG_ADD Plugin

Hi% username%
Once I had to write a form to add posts to the blog. In addition to the standard fields (name, date, text, etc.), it was necessary to screw the usable form of adding tags.
Because I code in jQuery, then the choice was clear.
Here are the necessary tasks that I set for myself:
  1. Easy to set up
  2. All tags are stored in one file (in cache)
  3. Minimum server and client load
  4. List of tags - prompts opens only for the selected request for a specific tag.


I will not go into the details of the plugin.

Connection - standard:


  1. < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" > < title > TAG_ADD. jQuery Plugin </ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" ></ script > <script type= "text/javascript" src= "tag_add_js/tag_add.js" > </ script > < link rel ="stylesheet" type ="text/css" href ="tag_add_css/tag_add.css"> </ head >
  2. < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" > < title > TAG_ADD. jQuery Plugin </ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" ></ script > <script type= "text/javascript" src= "tag_add_js/tag_add.js" > </ script > < link rel ="stylesheet" type ="text/css" href ="tag_add_css/tag_add.css"> </ head >
  3. < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" > < title > TAG_ADD. jQuery Plugin </ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" ></ script > <script type= "text/javascript" src= "tag_add_js/tag_add.js" > </ script > < link rel ="stylesheet" type ="text/css" href ="tag_add_css/tag_add.css"> </ head >
  4. < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" > < title > TAG_ADD. jQuery Plugin </ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" ></ script > <script type= "text/javascript" src= "tag_add_js/tag_add.js" > </ script > < link rel ="stylesheet" type ="text/css" href ="tag_add_css/tag_add.css"> </ head >
  5. < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" > < title > TAG_ADD. jQuery Plugin </ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" ></ script > <script type= "text/javascript" src= "tag_add_js/tag_add.js" > </ script > < link rel ="stylesheet" type ="text/css" href ="tag_add_css/tag_add.css"> </ head >
  6. < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" > < title > TAG_ADD. jQuery Plugin </ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" ></ script > <script type= "text/javascript" src= "tag_add_js/tag_add.js" > </ script > < link rel ="stylesheet" type ="text/css" href ="tag_add_css/tag_add.css"> </ head >
  7. < head > < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" > < title > TAG_ADD. jQuery Plugin </ title > < script type ="text/javascript" src ="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" ></ script > <script type= "text/javascript" src= "tag_add_js/tag_add.js" > </ script > < link rel ="stylesheet" type ="text/css" href ="tag_add_css/tag_add.css"> </ head >
* This source code was highlighted with Source Code Highlighter .

We draw the form and we cause a plug-in



<input type= "text" name= "tag_input" id= "tag_input_id" >
<br>
<em>( )</em></p>

<script>
jQuery( document ).ready( function (){
$( "#tag_input_id" ).tag_add();
})
</script>


* This source code was highlighted with Source Code Highlighter .


Can customize it


  1. <script>
  2. jQuery( document ).ready( function (){
  3. $( "#tag_input_id2" ).tag_add({
  4.     
  5. maxitem :0, // . -
  6. minlength :2, // . -
  7. maxlength :10, // . -
  8. loadinfo : 'loadtag.php' , //
  9.  
  10. });
  11. })
  12. })
  13. </script>

* This source code was highlighted with Source Code Highlighter .
That's the whole plugin, you can see a demo here.
Use))

')

Source: https://habr.com/ru/post/66125/


All Articles