Most voted "onclick" questions
Use this tag when the question refers to some resource, information or problem related to the "click" event, which occurs when the user clicks on an HTML element.
Learn more…98 questions
Sort by count of
-
11
votes4
answers12823
viewsHow to make a countdown with javascript?
Hello guys I don’t understand practically anything Javascript, so for weeks I was trying to make a script that did the following: 00:00:00 1º start a countdown of 20 minutes after clicking a link.…
-
11
votes2
answers8134
viewsWhat is the right approach to get the click/position in Recyclerview?
What is the right approach to click on Recyclerview? 1 - Inside onBindViewHolder use position, even if within setOnClickListener methods, which turns the position variable into FINAL; 2 - Inside…
-
5
votes1
answer5766
viewsDifference between onClick commands in React
When it comes to callback functions in Reactjs, what is the difference between the options below? onClick={() => this.onFunctionCickCall()} onClick={this.onFunctionClickCall()}…
-
3
votes1
answer360
viewsClick event on an SVG
I have a map of Brazil, in an SVG, where I would like to present a div next to each state when clicking on it. I managed to work the color change with hover using the ID of each state of Brazil:…
-
3
votes1
answer78
viewsLink click function is not called
I’ve had a similar problem, and that’s because the function is built before the button is created. Now I made little tertinho after I give an append on my page call a function on click. That’s my…
-
3
votes2
answers144
viewsHow to acquire the value of the onclick() event
I want an "if" that your condition is based on the location of the user’s click, but I have no idea how to refer to it. I believe on that basis you understand what I want to happen: if (onclick ==…
-
3
votes2
answers2998
viewsTake id onclick and send values via Ajax
I have a list of tasks, it has the status part, which shows for example 'On test' and a button of Approve. I’m trying with that button Approve when clicked take the task id and send an update to it…
-
3
votes1
answer122
viewsWhat is the difference between "javascript:void(0)" and only "void(0)" when defining onclick in HTML?
When using Phpstorm, I noticed a Warning pointing to the code where I did onclick="javascript:void(0)", recommending that you leave only onclick="void(0)". Is this a good and valid practice? I found…
-
3
votes1
answer40
viewsButton does not call web service method
I’m having trouble calling a method from my webservice,this method I send the boleto by email to the user, for some reason it’s not working. I have a listview with all the boletos and the user…
-
2
votes1
answer622
viewsProblem passing parameters to function
I have the following Javascript code to which I intend to pass parameters from an event onClick, but they are not recognised: HTML <a id="addplaylist" href="javascript:void(0);"…
-
2
votes3
answers55998
viewsRun php function with onclick
I want to know how I can run a php function with the onclick event on an element a, taking as an example: <a href="">Teste onclick</a> And the function: function testeOnclick() { echo…
-
2
votes6
answers710
viewsOn Click only works once
I have the following code to show and hide content, but it only works once. When I click again to hide, nothing happens. $(document).ready(function() { $('li[name=music]').off().on('click',…
-
2
votes2
answers1212
viewsHow to make a Listview "Clickable"?
I have a simple phone book system where there’s Activitys to: Register; Edition of the register; Removal of the register; And one last to see all contacts within one ListView. All records come from…
-
2
votes1
answer448
viewsUse onclick and ontouchstart
I have this div: <div onclick="funcao('')"> And in Iphone (mainly the 6) the onclick does not run very well. I saw that the ideal is to use the ontouchstart, but when I put both of the error,…
-
2
votes0
answers328
viewsPHP and javascript - Running onclick function properly
Hi, I’m a one-page developer for a client. Inside this page, I put a link in the header (header.php file) inside the DIV structure that is like this: <div onclick="irParaMinhasReservas();"…
-
2
votes4
answers31463
viewsOnclick calling two functions at the same time Javascript
Good morning, it is possible when clicking on a button run by onclick two functions at the same time, ex: two different Alert?
-
2
votes3
answers117
viewsFunction on the hyperlink
I am running a function on the hyperlinks of my system, as shown in the code below: <md-menu-item ng-repeat="insumo in insumos"> <a href ng-click="verificar('mostrarInsumos',…
-
2
votes2
answers54
viewsWhy does a Function invoked by onclick not influence external commands to it?
As can be seen in the code, the variables declared are global, and the routine should display the result on the console as soon as the "Send" button was selected. <!DOCTYPE html> <html>…
-
2
votes1
answer44
viewsRun function 1x per click (Javascript)
I have a button where his job is to mark one pixel on a div. However, after I click the button, in case I click several times on the image, it marks several pixels. How do I limit this marking to…
-
2
votes2
answers1505
viewsClickable image redirecting to another HTML page
I am very beginner in programming, however, to train I am doing an RPG in Browser, and the home page is the choice of class, and I want the person to choose, click the image and this image redirect…
-
1
votes1
answer591
viewsAdd CSS by clicking a button that goes to another page
I need to add height in a div when I click a button, only there is one but this div is on another page and that’s where I’m not able to do it, I’ll show you how I did in the code below if anyone can…
-
1
votes2
answers859
viewsOnclick type image
I’m having a hard time making an event onclick work. I wanted to swap an image of an image type input. I did a test with a simple Alert and also not called the function. Here’s part of my code.…
-
1
votes1
answer151
viewsError in Javascript for Chekar Asp:Checkbox
Good morning. I have the following code: HTML: <asp:CheckBox ID="ckPergunta" runat="server" onchange='SelectChoices(this);' /> Javascript: <script type="text/javascript">…
-
1
votes1
answer39
viewsOnclick with alternate calls
I wonder if there is any way to implement an alternate call in the function onclick, so that when I click once it performs a function, and when I click again call another function ... An example…
-
1
votes1
answer1326
viewsHow to invoke function at the first click of the button and another at the second click
How do I call the first function within the first click of the button, by event ondblclick(); and the second function at the second click of the same button. I imagine invoking the function of the…
-
1
votes3
answers422
viewsHow to pick any button through Onclick?
I have ten Buttons in my XML and I want you to change the Text of the button that the user click. I implemented a View.Onclicklistener in my Activity and my onClick was like this: @Override public…
-
1
votes4
answers3766
viewsHow to create a clickable div?
I have a div on my site and want to make it clickable through Javascript. How do I do that? Thanks.
-
1
votes1
answer605
viewsOnclick to close a modal without Reload
This button closes a modal, but needs to be without causing a Reload. There are ways? <button type="button" class="close" data-dismiss="modal" aria-label="Close"…
-
1
votes2
answers2357
viewsHow to call two functions in onClick (Reactjs)?
Here are my two functions, chamaLogin = () => { this.setState({ redirect: true }); }; ----------------------------------------------------------------------------- handleSubmit = event => {…
-
1
votes2
answers620
viewsonClick in edittext that cannot be editable
How to make an event click on an edittext, enabled="false" ? (I couldn’t do it without the focus being on edittext, enabled="true") Or, an event click on an edittext that cannot be editable. Code…
-
1
votes0
answers17
viewsElements Events Rendered by the v-html Directive in Vue.js
How do I use an event in an element rendered by the v-html directive? The Vue (@event) events do not work.. I tried calling a function by onclick, but it is not found. <button onclick="test()"…
-
1
votes1
answer5521
viewsClick on listview item
I have the following code, which shows the items in a list, on the screen: Activity: public class InviteActivity extends ListActivity implements InviteView { @Override protected void onCreate(Bundle…
-
1
votes0
answers185
viewsEvent '.on('click', Function(){});' triggers Multiple Times
Good Morning, I’m working on a page where there are several ul dynamic, that is to say with li being implemented in them via input and counted through several variables (one for each ul), and to…
-
1
votes1
answer415
viewsOnitemclicklistener to open an Activity
I have the following problem, I am using a list view and a search view, and when I click on an item, I would like to open an Activity and show a Toast. So far so good, when I search and click on…
-
1
votes1
answer67
viewsHow to assign multiple events to the same button?
I have a layout where I can only have one button and need to use the same layout for various events onClick in a cardView. How do I get this? public void onClick(View arg0) { switch…
-
1
votes1
answer64
viewschange listview play in audio
I’d like to change that listview scheme instead of pressing the play buttons, I just want to press the list item and it (in case) plays the sound and when I click on another item it stops the q was…
-
1
votes1
answer32
viewsI cannot update the value of a String by clicking on a certain button
I’m doing a calculator project and I’m not able to update the screen when someone keystrokes the number 7, for example. Here’s the code: HTML: <html lang="en"> <head> <meta…
-
1
votes1
answer620
viewsCreate button effect pressed
I have the following component in React: import React, { Component } from 'react'; class Counter extends Component { constructor(props) { super(props); this.state = { count:…
-
1
votes2
answers1054
viewsmount url to open new tab with parameters passed by onclick
How to do a function to handle parameters passed on onclick to mount a URL and open it in a new tab? Example: <button onclick="javascript:parent.funcao1('TESTE','ABCD',…
-
1
votes1
answer28
viewsI cannot return onclick property to a button with its parameters
I created a simple hangman game, in which within multiple themes a secret word is chosen randomly. The user has at his disposal 27 buttons, each one with a letter of the alphabet and when clicking a…
-
1
votes2
answers114
viewsImageview Visible with onClick becoming invisible again?
Talk to you guys, I have an Image that starts invisible and when clicking the button it becomes visible, but I need it to be invisible again because when clicking the button again, it has to appear…
-
1
votes2
answers66
viewsEvent with onclick
I am styling an input/search field using the onclick of javascript, I can do 50% but the rest I’m cracking my head and I don’t know what to do. I was able to make the text input box to make the…
-
1
votes1
answer100
viewsMultiple Rotate images on the same click
Good afternoon, I have a question. I intend that when we click on a button a random image of an 80-card deck will appear. Then if we click again on that same button, another card appears next to the…
-
1
votes1
answer33
viewsProvider to intercept click buttons
The project I am developing is composed of many forms with several buttons. What I need to develop is a way to catch double clicks and unnecessary requests for the API. So I developed a directive…
-
0
votes1
answer921
viewsPHP use onclick to perform another page function
I have the following link in a header (header.php): <a href="./index.php" id="btnMinhasReservas2" onclick="irParaMinhasReservas()" class="ph00_9"></a> The idea is, when I click on this…
-
0
votes2
answers758
viewsUpdate layout from a button
On the main screen of my app there are two buttons, an arrow to the right and another to the left symbolizing the previous and next months, in them I call an index to reload the page with the values…
-
0
votes1
answer35
viewsButton with cookie and Location
At the beginning of my page includes the cookie: <?php setcookie("agenda","2016");?> At the bottom of the page, without using form, I have the following button: <button class="button…
-
0
votes3
answers563
viewssetOnItemLongClickListener is not working
Can someone help me by telling me setOnItemLongClickListener not being called when I give a long click on my list item? I have in the same Adapter 2 methods of type onclick, one is the…
-
0
votes1
answer300
viewsCalling methods from another class
In case I need to call a method of another class to perform an insertion in the database and I have to pass an object of type Usuario as a parameter Code: protected void onCreate(Bundle…
-
0
votes1
answer168
viewsJquery onclick and focusout
I have my navbar with a search button that calls a slideToogle() and displays a form with a text input inside below my navbar. I want my form to be hidden when losing focus or the search button to…