Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7707883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:28:19+00:00 2026-06-01T00:28:19+00:00

I have this. I want to click and transfer the clicked data to another

  • 0

I have this. I want to click and transfer the clicked data to another collection using backbone.js Is this possible? Any ideas?

define([
'jquery',
'underscore',
'backbone',
'model/item_model',
'model/cart_model',
'collection/item_collection',
'text!templates/items/itemlist.html'
],function($, _, Backbone, Item, Cart, ItemCollection, ItemListTemplate){

var ItemListView = Backbone.View.extend({
el: $("#mainContainer"),
events:{
    "click div.itemList" : "AddToCart"
},
initialize: function(){
  this.model = Item;
  this.collection = ItemCollection;
  this.collection.bind("reset", this.render );
},
render: function(){
  var data = {
    items: ItemCollection.models,
    item: Item
  }
  var compiledTemplate = _.template( ItemListTemplate , data);
  $("#itemContainer").html( compiledTemplate );
},
AddToCart:function(ev){
    //console.log("here");
    ev.preventDefault();
    var itemcode = $(ev.currentTarget);
    console.log(itemcode);
    //alert($(ev.currentTarget).text());
}
});
return new ItemListView;
 });

So since i have my click event firing up i want to click and transfer it to another collection. is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:28:20+00:00Added an answer on June 1, 2026 at 12:28 am

    Using the remove and add functions should do the trick. A basic example

    var c1=new Backbone.Collection([{id:1},{id:2},{id:3}]);
    var c2=new Backbone.Collection();
    var m=c1.at(1);
    
    c1.remove(m);
    c2.add(m);
    
    console.log(c1.pluck("id"));
    console.log(c2.pluck("id"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to draw image in place where I click. i have this code:
I want to be able to click the button and have it copy this:
Possible Duplicate: jquery highlight the link when clicked I have this nav: <div id=nav>
I have this: <a class=top_level_active href=javascript:Submit('menu_home')>Account Summary</a> I want to click that link but
I have this link (not a button) that I want to click on ...I
I have this button and I want when you click on it he will
I have this problem: I want to generate a new source code file from
I have this fiddle : http://jsfiddle.net/XjeCf/1/ that works like I want and this one
I have this code and I want to have my button as a square,
I have this script where I want to add an object to an array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.