Testing jQuery Plugin Options

by nickadeemus2002

HTML

<div id="result"></div>

<h2><a href="#" id="addScnt">Add Another Input Box</a></h2>
<div id="p_scents">
    <p>
        <label for="p_scnts">Input Value</label><input type="text" id="p_scnts" size="20" name="p_scnt"  /><a href="#" id="addScnt">Add</a>
    </p>
</div>

CSS

* { font-family:Arial;font-size:0.95em; }
h2 { padding:0 0 5px 5px; }
h2 a { color: #224f99; }
a { color:#999; text-decoration: none; }
a:hover { color:#802727; }
p { padding:0 0 5px 0; }

JavaScript

$(document).ready(function() {
    var selectOptions, item, id, text;
    
    var rawOptions = {node: {oValue:'email', oText:'Email'},
                      node: {oValue:'instantmessage', oText:'Instant Message'},
                      node: {oValue:'phone', oText:'Phone'}
                     };
    
    for(item in rawOptions){
        alert(item);
        if (rawOptions.hasOwnProperty(item)) { 
           //id = rawOptions.item.oValue;
           //text = rawOptions.item.oText;
          // alert('the id is:' + id + ' and the text label is: '+text);      
        }        
    }               

    
    
    
    $(function() {
        var scntDiv = $('#p_scents');
        var i = $('#p_scents p').size() + 1;

        $('#addScnt').live('click', function() {
            $('<p><select id="' + i + '">' + selectOptions + '</select><input type="text" id="p_scnts" size="20" name="p_scnt_' + i + '"  /><a href="#" id="addScnt">Add</a> <a href="#" id="remScnt">Remove</a></p>').appendTo(scntDiv);
            i++;
            return false;
        });

        $('#remScnt').live('click', function() {
            if (i > 2) {
                $(this).parents('p').remove();
                i--;
            }
            return false;
        });
    });

});