Editing Query list selection click

Hi guys,

Basically I have this page:

http://test.urban-indoors.co.uk/shop/all-fires/all-fires/dimplex-chalbury-electric-fire-1113964.html

The essential extras are list items, I now want to change them so as the user actually has to click the 'Click to add this product to your selection' button rather than just anywhere within the <li>

Is this possible?

Thanks,
Dean.
deanlee17Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
In your code you are binding the click event to the LI. You need to change that to the image.

// $("#relatedexpress li").click(function(){ //remove this line
$("#relatedexpress .message img").click(function(){

Open in new window

Now the click will be bound to the button.

Inside your click() function your are currently referring to 'this' which is the element clicked. At the moment that's the LI, but with the above change will become the IMG, so you may need to change the code inside:

Instead of this:

$(this).toggleClass("selected");
$(this).find("form").trigger('submit');

Open in new window

You'll need this:

var clickedli = $(this).parents("li");
$(clickedli).toggleClass("selected");
$(clickedli).find("form").trigger('submit');

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
deanlee17Author Commented:
Hi Chris,

Thanks for the reply, I implemented those changes, no change tho?

Cheers,
Dean
0
Chris StanyonWebDevCommented:
There are changes. The click event is now bound to your img, so when you click on it your code runs. It puts a tick in the box, hides the button and submits your form.

You will need to change some of your CSS as well. Currently you're setting the cursor to the pointer:

//line 1534 of stylesheets2013c.css
#relatedexpress li { cursor:pointer; } <!--remove this

//Add this to stylesheets2013c.css
#relatedexpress li .message img { cursor:pointer; }

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

deanlee17Author Commented:
Thanks Chris, that works perfectly.

Just one last thing, I am going to put another image in there, how can I make our changes unique to just that one image?
0
Chris StanyonWebDevCommented:
Give it a class and then change the jQuery selector:

<img class="extrasButton" src="..." />

and your jQuery selector:

$("#relatedexpress .extrasButton").click(function()) {
0
deanlee17Author Commented:
Perfect, thanks a million
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.