How to insert tags into database using jquery html and php

I want to insert these particular tags into the database. This is my HTML:

<div id="tags">
    <input type='text' name='tags' placeholder='Type in topic tags here seperated by commas' id="tagg" />

and the jQuery part:

 counter = 0;
        $('#tags input').on('focusout',function(){    
        var txt= $.trim( $(this).val() ).replace(',','');
        $(this).before('<span class="tag"  name="tags[]" value="'+txt+'">'+txt+'</span>');
            $('#tags input').prop('disabled', true);
        //$(".bgtopic").append("<input type='hidden' name='tags[]' />")
        //Yet to implement the counter varibale to be visible...

  }).on('keyup',function( e ){

     $('#tags input').prop('disabled', false);



What the piece of code creates a tag when a user is creating a new post on my forum, just like the way it is here on StackOverflow. I want to be able to store the tags so that I can use them to create a tag cloud. How can I accomplish this?



you have to do an ajax request via jquery.

you can find a lot of tutorials on web how to do that (e.g.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.