I'm pletely 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 "". Ive tried using the following script
<script src=".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.
I'm pletely 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./products/women/outerwear/jackets/chanel-jacket-931420". Ive tried using the following script
<script src="http://ajax.aspnetcdn./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.
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
Try this:
If add-to-cart-button
is ID:
$("#add-to-cart-button").trigger('click');
If add-to-cart-button
is Class:
$(".add-to-cart-button").trigger('click');
I think $("#add-to-cart-button").click(); will work for you based on if add-to-cart-button is id of that button.
Hi try the below code this should help
<script src="http://code.jquery./jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".add-to-cart-button").trigger('click');
});
</script>
Happy Coding :)