Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
edited tags
Link
The site is not running jQuery; removed tags from title; spelling; grammar; noise reduction.
Source Link
Makyen
  • 33.6k
  • 12
  • 94
  • 128

Not working button functionallity by clicking How do I programmatically click a button using jQuery or javascripton this page when .click() does not work?

Actually i, I am working on aan extension which help to buy product from flipkart during flash sale. On teh product page i cantI can't click on Buy Now"Buy Now" button with the help of javascriptsJavaScript its show me undefineundefined this is the code of Buy Now button:

<form><button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button></form> 

ThisThe Button is in this page  

I am using the code to click this button in my javascriptJavaScript file

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

but it show me undefined while ifHowever, even when I go to the page on the site and, in the console, execute

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

The console shows undefined and does not start the "Buy Now" process that is started by manually using the mouse to click on the "Buy Now" button. In the console, executing

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c"); 

Shows:

<button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button> 

which is the correct button that I desire to programmatically click. Note that even though I used $(), what is returned is not a jQuery Object.

If I click on that button manually thats works to check, I'm shown the problem goto on dialog for "Buy Now". You can go to this page link and open console in developer mode try to click on Buy Now Button using JavaScriptit yourself.

  • I am not getinggetting what is the problem here is. Is there any problem in my code or its any kind of protection form filpkart website side?

Not working button functionallity by clicking a button using jQuery or javascript

Actually i am working on a extension which help to buy product from flipkart during flash sale. On product page i cant click on Buy Now button with the help of javascripts its show me undefine this is the code of Buy Now button

<form><button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button></form> 

This Button is in this page  

I am using the code to click this button in my javascript file

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

but it show me undefined while if I click on that button manually thats works to check the problem goto on this link and open console in developer mode try to click on Buy Now Button using JavaScript

  • I am not geting what is the problem here is there any problem in my code or its any kind of protection form filpkart website side

How do I programmatically click a button on this page when .click() does not work?

Actually, I am working on an extension which help to buy product from flipkart during flash sale. On teh product page I can't click on "Buy Now" button with the help of JavaScript its show me undefined this is the code of Buy Now button:

<form><button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button></form> 

The Button is in this page

I am using the code to click this button in my JavaScript file

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

However, even when I go to the page on the site and, in the console, execute

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

The console shows undefined and does not start the "Buy Now" process that is started by manually using the mouse to click on the "Buy Now" button. In the console, executing

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c"); 

Shows:

<button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button> 

which is the correct button that I desire to programmatically click. Note that even though I used $(), what is returned is not a jQuery Object.

If I click on that button manually, I'm shown the dialog for "Buy Now". You can go to this page and try it yourself.

  • I am not getting what is the problem here. Is there any problem in my code or its any kind of protection form filpkart website side?
added 704 characters in body
Source Link

Actually i am working on a extension which help to buy product from flipkart during flash sale. On product page i cant click on Buy Now button with the help of javascripts its show me undefine this is the code of Buy Now button

<form><button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button></form> 

This Button is in this page

I am using the code to click this button in my javascript file

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <form><button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button></form>

 
$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

but it show me undefined while if I click on that button manually thats works to check the problem goto on this link and open console in developer mode try to click on Buy Now Button using JavaScript

  • I am not geting what is the problem here is there any problem in my code or its any kind of protection form filpkart website side

Actually i am working on a extension which help to buy product from flipkart during flash sale. On product page i cant click on Buy Now button with the help of javascripts its show me undefine this is the code of Buy Now button

This Button is in this page

I am using the code to click this button in my javascript file

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <form><button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button></form>

 
$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

but it show me undefined while if I click on that button manually thats works to check the problem goto on this link and open console in developer mode try to click on Buy Now Button

  • I am not geting what is the problem here is there any problem in my code or its any kind of protection form filpkart website side

Actually i am working on a extension which help to buy product from flipkart during flash sale. On product page i cant click on Buy Now button with the help of javascripts its show me undefine this is the code of Buy Now button

<form><button class="_2AkmmA _2Npkh4 _2kuvG8 _7UHT_c" type="button"><span class="_279WdV"></span> <!-- -->BUY NOW</button></form> 

This Button is in this page

I am using the code to click this button in my javascript file

$("._2AkmmA._2Npkh4._2kuvG8._7UHT_c").click(); 

but it show me undefined while if I click on that button manually thats works to check the problem goto on this link and open console in developer mode try to click on Buy Now Button using JavaScript

  • I am not geting what is the problem here is there any problem in my code or its any kind of protection form filpkart website side
edited tags
Link
Makyen
  • 33.6k
  • 12
  • 94
  • 128
Loading
you can check the problem at the given link
Source Link
Loading
edited body
Source Link
MBehtemam
  • 7.9k
  • 17
  • 68
  • 111
Loading
added 6 characters in body
Source Link
MBehtemam
  • 7.9k
  • 17
  • 68
  • 111
Loading
Source Link
Loading