Im using Supersized jQuery plugin (http://buildinternet.com/project/supersized/) to show my own photos to the visitors. The visitor can purchase every image on the site, so I decided to add a Buy Now button.
I would like to use PayPal for this, and I found an easy solution for that. The problem is with the buy now button, because every image has unique price, so I need to change the price parameter in the anchor's href attribute. How can I do that?
Welcome to SO, just a heads up but it's best to include any related code you already have and/or include a Fiddle that replicates you're problem.
If you're looking to add some information to a anchor href attribute then you can do something like the below.
The price could be included in a data-
attribute on the image.
<img src="your/image/source.jpg" data-price="100" />
You could then include a click handler to the buy now button that retrieves price from the closest image and then adds it to the href
attribute.
$('.buynow').on('click', function(){
//Find closest image
closestImage = $(this).closest('img');
//Get the price
imagePrice = closestImage.data('price');
//Add the price to the href of the .buynow button
$(this).attr('href','http://yourpaypalscreen.com/' + imagePrice + '/etc');
});
Please note this isn't a working solution but an example to get you started.