I am developing an e-commerce site with java-ee, and I am stuck on the add to wish list button.
Here is an explanatory image:
the blue button that is in each card is the button in i speak.
In fact I want that as soon as I click on this button the chosen product is added to the wish list and that this icon:
increment by 1 example here there is the number 3 at the top of the icon, I want that as soon as I click on the button, the chosen product is added to the wish list and the number that is in the icon increases, for example in this example it will be 4.
The problem is that I really don't know how to do it, I know when can do this thanks to js but I have no idea what the code looks like to increase the number that is in the icon.
If anyone would give me sites that explain this or explain to me how to do it I would be very grateful to them.
I am trying to create a display menu with different information depending on the "button" you click.
If it is only a button, my code is working fine. The problem comes when I include multiple options.
This is a representation of what I want to build: https://ibb.co/KyPY53c
You basically want to build tabs. This is what you are asking for. Please provide more explanation or code with your next questions.
Ive looked around a bit and not found anything so im not even sure if this is possible.
What I want to do is have a drop down list. Each list item is a specific type of a view for a list. Is it possible to add an icon at the end that when clicked will fire off a different action to just selecting the item?
So the user opens the drop down. They see View 1. At the end there is a pencil button image. If they select View 1 the list view changes. If they select the pencil it opens up the edit View dialog for that view.
Is this even possible using javascript/jQuery?
It won't be do-able with the standard select element, however it's definitely possible using divs and heavy Javascript/jQuery.
Something similar to how the jQuery plugin Chosen works - it hides the original select element and rebuilds it with divs, adding interaction with jQuery (obviously).
I'm trying to achieve something, but I don't know if it is even possible.
On a page I have a selectbox with a number of options. There's also a div section on the same page.
I would like to be able to select one or more options, press a button and make the selected items disappear from the selectbox, and appear inside the div. And all this sorted as well.
Now, I have got this part of the code working (have to admit that I "borrowed" the code from several places...)
code:
JSFiddle
The second part I'd like to achieve is to be able to select the elements in the div, click another button, and have the elements removed from the div and re-appear in the selectbox. Sorted again.
I think I have to change the type of the element when transferring from selectbox to div (maybe into an li ?), in order for them to be selectable, and on the way back, convert the type to <option> again, but I don't know how....
What happens now when I select an option and bring it to the div, the text in the div also has the form '<option>'...'</option>' , because it has been exactly copied.
I'm hoping I'm making sense here, and I hope there is someone who can point me in the right direction. If I'm going about this in the completely wrong way, please tell me.
By the way, it's easy if I was using two selectboxes, but I can't. It has to be one selectbox and one div......
Thanks, Hans
As we said in main post comments, here are some issues you have :
How to select elements in jQuery
I know that you know, but in your example you want to move elements from a div to another, you'll need for that to put each value in a div (then you'll be able to select each one).
How to make div selected
Your second issue is that you want to be able to select divs in the right box to copy them back in the select :
$("body").on("click", ".rightElements", function(key, element){
$(element).addClass("selected");
})
Then you can do :
$(".rightToLeftButton").click(function(){
// Your $(".selected") divs value go to the select
});
This piece of code provides new issues :
How can I unselect selected on clicking other divs ?
How can I select multiple divs ?
Etc. etc.
(I'm sure with practice, tests, and logic you'll do it!)
If you achieves these points, you can achieve all others of your problems, when you have a problem you can't explain with an unique phrase (who can be long :)), ask you if there are not several issues, separate them and look for answers !
It seems rude but you should take a look at :
http://eloquentjavascript.net/
https://jquery.com/
https://developer.mozilla.org/en/docs/Web/JavaScript
https://stackoverflow.com/tags/javascript/info
Regards,
I need exactly same feature as following dropdown or combo
Typable inside combo and auto complete,
2000 of items or more.
Should not show items list while typing.
Should show items list after pressing downkey or button.
while showing items list, must shows 3 or 4 items at a time and scoll and focus.
Hope you get my problem.
Take a look at jQuery Autocomplete. It has most most features you require, and you can probably customize it to get the rest.
At least you get a solid basis to build upon.