That's not a problem of Cordova, it's a problem of your posted code.
That's how you do it:
<html>
<head>
<title>Search Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.getElementsByTagName("input")[0].addEventListener("click",
onSearchKeyDown, false);
/*Alternative and better way is adding the id attribute to the input like I
did (see the second input)
and then use the following code line:
document.getElementById("search").addEventListener("click",
onSearchKeyDown, false);
*/
}
// Handle the search button
//
function onSearchKeyDown() {
console.log('ok');
}
</script>
</head>
<body onload="onLoad()">
<input type="search" />
<input type="search" id="search" />
</body>
</html>
2018-04-19 20:46 GMT+02:00 Jesse <[email protected]>:
> Hi Ranjan,
>
> This list is for development of the cordova framework itself, and not
> really for user support.
>
> First steps, are maybe to try using an alert to make sure the button
> handler code is called, and also try a console.log in some code that you
> know is called and make sure it shows up. Then you at least should have a
> direction to look.
>
> After that, I suggest you search and/or post on stack-overflow.
>
> Cheers,
> Jesse
>
>
>
> @purplecabbage
> risingj.com
>
> On Thu, Apr 19, 2018 at 9:42 AM, ranjan sasmal <[email protected]>
> wrote:
>
> > Hi Sir,
> >
> > please help me my issues . I can't understand why searchbutton is not
> > working on cordova app during search key pressed in android.
> >
> > Below my code..............
> >
> > <html>
> > <head>
> > <title>Search Button Example</title>
> >
> > <script type="text/javascript" charset="utf-8"
> > src="cordova.js"></script>
> > <script type="text/javascript" charset="utf-8">
> >
> > // Wait for device API libraries to load
> > //
> > function onLoad() {
> > document.addEventListener("deviceready", onDeviceReady, false);
> > }
> >
> > // device APIs are available
> > //
> > function onDeviceReady() {
> > // Register the event listener
> > document.addEventListener("searchbutton", onSearchKeyDown,
> false);
> > }
> >
> > // Handle the search button
> > //
> > function onSearchKeyDown() {
> > console.log('ok');
> > }
> >
> > </script>
> > </head>
> > <body onload="onLoad()">
> > <input type="search" />
> > </body>
> > </html>
> >
> > It should console ok msg . but it is not working why?
> >
> > Thanks
> > Ranjan Sasmal.
> >
>
--
Herzliche Grüße / Kind Regards
Florian Pechwitz
Core Developer
E [email protected] W www.itizzimo.com - www.simplifier.io
<https://www.linkedin.com/company/2979169>
<https://www.xing.com/companies/itizzimoag>
--
iTiZZiMO AG - Nürnberger Str. 47A - 97076 Würzburg - Germany
<https://maps.google.com/?q=N%C3%BCrnberger+Str.+47A+-+97076+W%C3%BCrzburg+-+Germany&entry=gmail&source=g>
Registered Office: Würzburg - Registered Court: Amtsgericht Würzburg, HRB
12879
Supervisory Board: Prof. Dr.-Ing. Volker Bräutigam (Chairman),
Matthias Weber, Michael Mühleck, Prof. Dr. Karl Liebstückel
Executive
Board: Reza Etemadian (Chairman), Christian Kleinschroth, Christopher
Bouveret, Florian Rühl
©2018 iTiZZiMO AG. This message and any attachments
including its content such as text, images, logos, graphics, videos are
property of iTiZZiMO AG, protected by german and international copyright
laws and must be treated strictly confidential. It may not - neither
completely nor partially - be changed, copied, reproduced, distributed or
made available to the public without the prior written consent of iTiZZiMO
AG or its subsidiaries.