tagged [onclick]

Trigger a button click with JavaScript on the Enter key in a text box

Trigger a button click with JavaScript on the Enter key in a text box I have one text input and one button (see below). How can I use JavaScript to when the key is pressed inside the text box? There i...

How to check if android checkbox is checked within its onClick method (declared in XML)?

How to check if android checkbox is checked within its onClick method (declared in XML)? I have a checkbox in android which has the following XML: This is my onClick() method in my Activity class. ```...

20 Dec at 10:7

How can I simulate an anchor click via jquery?

How can I simulate an anchor click via jquery? I have a problem with faking an anchor click via jQuery: Why does my thickbox appear the first time I click on the input button, but not the second or th...

16 Jul at 10:11

OnClick vs OnClientClick for an asp:CheckBox?

OnClick vs OnClientClick for an asp:CheckBox? Does anyone know why a client-side javascript handler for asp:CheckBox needs to be an OnClick="" attribute rather than an OnClientClick="" attribute, as f...

How to toggle font awesome icon on click?

How to toggle font awesome icon on click? I am using font awesome 'plus' icon on expandable categories list items. When they are in expanded state i want to show a 'minus' sign' ``` Category 1 ...

24 Apr at 10:40

Simple if else onclick then do?

Simple if else onclick then do? 1. How do I make it so if yes button clicked change colour? 2. Is using .onclick the best option for this? 3. Am I doing it the optimal way? Thanks. html: css: ``` #box...

Change value of input and submit form in JavaScript

Change value of input and submit form in JavaScript I'm currently working on a basic form. When you hit the submit button, it should first change the value of a field, and then submit the form as usua...

13 Jul at 21:22

add onclick function to a submit button

add onclick function to a submit button I'm just learning javascript and php. I created a contact form and I'd like the submit button to accomplish two things when I press it: 1. submit the data to me...

23 May at 12:34

Remove an onclick listener

Remove an onclick listener I have an object where the text cycles and displays status messages. When the messages change, I want the click event of the object to change to take you to the activity tha...

4 Mar at 14:57

How exactly does the android:onClick XML attribute differ from setOnClickListener?

How exactly does the android:onClick XML attribute differ from setOnClickListener? From that I've read you can assign a `onClick` handler to a button in two ways. Using the `android:onClick` XML attri...

28 Feb at 12:11

React onClick function fires on render

React onClick function fires on render I pass 2 values to a child component: 1. List of objects to display 2. delete function. I use a .map() function to display my list of objects(like in the example...

Onclick CSS button effect

Onclick CSS button effect I'm creating a CSS button and I'm trying to make an onclick effect: when the user clicks on the button it would push down the button text by 1px. My problem here is that it's...

23 Feb at 17:44

Change Button color onClick

Change Button color onClick I want my `Button` to change color every time I click on it. But it only changes color on the first click. I believe the problem is in the `setColor` function. Every time I...

14 Nov at 19:26

Multiple submit Button click problem?

Multiple submit Button click problem? I have a form which inserts data in DB on Submit button click but the problem is when client click the button multiple times its sends multiple create requests me...

19 Oct at 13:50

onclick="location.href='link.html'" does not load page in Safari

onclick="location.href='link.html'" does not load page in Safari I cannot get `onclick="location.href='link.html'"` to load a new page in Safari (5.0.4). I am building a drop-down navigation menu usin...

13 Apr at 15:52

Change image source with JavaScript

Change image source with JavaScript So I'm new with JavaScript (this is actually my first attempt to make something work) and I'm having a bit of trouble. I thought I had enough knowledge to make this...

13 Feb at 21:49

OnclientClick and OnClick is not working at the same time?

OnclientClick and OnClick is not working at the same time? I have a button like the following, When I use my button like that, onclick is not firing. When I remove OnClientClick, then onclick is firin...

Simulating a click in jQuery/JavaScript on a link

Simulating a click in jQuery/JavaScript on a link I want to simulate a click on any link on a page using JavaScript. If that link has some function binded to its 'onclick' event (by any other JS I don...

3 Dec at 12:28

ComboBox.MaxDopDownItems is not working when adding items using the Click event

ComboBox.MaxDopDownItems is not working when adding items using the Click event I am populating the ComboBox items with a list using the Click event. When it is already populated the MaxDropDownItems ...

6 Oct at 01:19

JavaScript: changing the value of onclick with or without jQuery

JavaScript: changing the value of onclick with or without jQuery I'd like to change the value of the `onclick` attribute on an anchor. I want to set it to a new string that contains JavaScript. (That ...

5 May at 19:58

how to pass this element to javascript onclick function and add a class to that clicked element

how to pass this element to javascript onclick function and add a class to that clicked element I had an html navigation code as below ``` function Data(string) { //1. get some data from server accor...

17 Apr at 17:48

onclick on a image to navigate to another page using Javascript

onclick on a image to navigate to another page using Javascript I am getting warmed up with Javascript so I am trying something on my own. I am searching for a onclick function, where I have thumbnail...

16 Dec at 16:20

start/play embedded (iframe) youtube-video on click of an image

start/play embedded (iframe) youtube-video on click of an image I'm trying to start playing an embedded youtube video by clicking an image. The idea is to have an image on top of a video, and when the...

6 Jun at 00:48

ASP.Net double-click problem

ASP.Net double-click problem having a slight problem with an ASP.net page of mine. If a user were to double click on a "submit" button it will write to the database twice (i.e. carry out the 'onclick'...

Blazor onclick event not triggered

Blazor onclick event not triggered I try to implement a simple onclick event handler like this sample [https://blazorfiddle.com/s/counter](https://blazorfiddle.com/s/counter) but not working in my sol...

26 May at 08:53