Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
48
rated 0 times [  54] [ 6]  / answers: 1 / hits: 37526  / 10 Years ago, thu, december 18, 2014, 12:00:00

I'm completely new to scripting and i'm having an awful time trying to create a script so that it automatically clicks an Add to Cart button on the webpage once I visit it. An example on the website is the item https://www.therealreal.com/products/women/outerwear/jackets/chanel-jacket-931420. Ive tried using the following script



<script src=http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.8.0.js 
type=text/javascript>/script>
<script type=text/javascript>
$(function(){
setTimeout(function() {
$(add-to-cart-button).trigger('click');
},1);
});
</script>


But there was no luck. If someone could help me create a script that would automatically click the add to cart button once I visit any item on the website I would be extremely grateful and would even be willing to pay for this script. Oh also im on a mac if it makes a difference.


More From » jquery

 Answers
5

i think if you follow the idea that i will show, you will catch the solution



consider that you have two buttons one called Call set time out and another is your desired button Add to cart



and on Call set time out click event you want to call Add to Cart button event so you should do the following



the html will be



<input type=button id = Call-set-time-out value= Call set time out />
<input type=button id = add-to-cart-button value= Add to cart/>


and the jquery script will be



 $( #Call-set-time-out ).click(function() {
$(#add-to-cart-button).trigger('click');
});

$( #add-to-cart-button ).click(function() {
alert( add-to-cart-button .click() event called. );
});


i hope this will help you and good luck for you journey in Jquery world


[#68453] Monday, December 15, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
darrell

Total Points: 109
Total Questions: 113
Total Answers: 113

Location: Zambia
Member since Sat, Oct 31, 2020
4 Years ago
;