Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <label>Tags<a class="required_field">*</a></label>
- <div id="wrapbox">
- <div id="box">
- <span id="checktags"></span>
- <input type="text" class="to-be-clicked" id="tags" maxlength="230">
- </div>
- </div>
- $('#tags').keypress(function(e) { //Check if space was clicked, and create a new tag
- if(e.which == 32) {
- var tx = $('#tags').val();
- if (tx) {
- $(this).val('').parent().before('<li class="tags"><span><input type="hidden" value="'+tx+'" name="tags[]" />'+tx+'</span><a style="cursor:pointer;" id="close">[x]</a></li>');
- closer();
- }
- }
- });
- $(function(){
- var template = $('#jb').clone();
- var offersCount = 1;
- window.addoffer = function(){
- offersCount++;
- var offer = template.clone().find(':input').each(function(){
- var newId = this.id.substring(0, this.id.length-1) + offersCount;
- this.name = this.id = newId; // update id and name (assume the same)
- }).end()
- .attr('id', 'att' + offersCount)
- .prependTo('#jb');
- }
- $('.add').click(addoffer);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement