SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Add to list. Please, could someone help me out?

    Hello,

    I am trying to create a JQuery plugin that does the following:

    On a form, when a button is pressed, a few form elements values are used to create a string (CSV format).
    This string is added to an ordered list and with a remove button to remove it from the list.

    I would like to "tell" the plugin which ids of the inputs should be used and the id of the button that triggers the adding.

    I am using livequery and at the moment I have the following:
    http://www.27lamps.com/Beta/List/List.html

    Could someone, please, help me out?

    Thanks,
    Miguel

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    You are missing an ending curly brace somewhere
    Code JavaScript:
    $(document).ready(function() {
     
    	$.fn.createList = function(list){
    		var origin = this;
    		$(':submit',origin).bind('click',function(){
    			str = [];
    			console.log($('input,select,checkbox:checked',origin));
    			$('.name,.country,.newsletter:checked',origin).each(function(){
    				str.push($(this).val());
    			});
    			str = str.join(',');
    			$('<li></li>').appendTo(list).append(str).append(' <a href="#remove" class="remove">Remove Item</a>');
    			return false;
    		});
     
    		$('#MyList').createList();
     
    	});


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •