javascript - get object data
<p>In my rails application, i have a form where user has to select some items via checkbox. I want to display the selected items' information in a div.</p>

<p>I am currently using javascript to do that.</p>

<p>So in form, when user clicks in a checkbox, i pass the 'this' obj as parameter to a javascript function which then appends the 'this.value' to the end the div.</p>

<p>However appending the 'this.value' displays only the id of of the selected item. I also want to display the other data of the selected item in the div.</p>

<p>Is that possible in javascript? How do i get other information of the 'this' obj, apart from 'this.value'?</p>

<p>Many thanks for any suggestion provided. </p>

<p>Please find code below- </p>

<pre><code>#in my form:
&lt;input id="id_&lt;%= item.id %&gt;" name="submission[item_ids][]" onclick="addtoselected(this);" value="&lt;%= item.id %&gt;" type="checkbox" /&gt;
</code></pre>

<p>javascript code:</p>

<pre><code>function addtoselected(obj){
    if(obj.checked==true){
    var s = '&lt;div&gt;' + obj.value + '&lt;/div&gt;';
    $j('#selected_recs').append(s);
    }
}
</code></pre>
