OnClick event doesn't work in Chrome
You should not use the onClick
Event within option
Elements. Use the onchange
event of the select instead as already discussed in this question: javascript onclick alert not working in chrome .
onclick event not working on google chrome
Instead of using onclick
attribute for your submit
button, onsubmit
for your <form>
Try replacing your code as follows
<form id="form_cad" action="my_php.php" method="post" enctype="multipart/form-data" onsubmit="return confirmMessage();">
<input type="text" name="email" id="email">
<input type="submit" id="submit1" value="Add"/>
</form>
OnClick Function does not work on Chrome?
Try to use onChange
instead of onClick
for select element.
<select class="form-control donn" name="today" onChange={handleChange}>
Just add value to your custom option and check for it in the if statement
<option value="custom">
Custom
</option>
export class Filter extends Component {
constructor(props, context) {
super(props, context);
this.state = {
isOpen: false,
};
}
handleChange = (event) => {
if (event.target.value === "custom") {
this.setState({ isOpen: !this.state.isOpen });
}
};
render() {
return (
<div className="filter_range">
<select class="form-control donn" name="today" onChange={handleChange}>
<option selected disabled hidden>
Choose{" "}
</option>
<option value="today">Today</option>
<option value="yesturday">Yesterday</option>
<option>Last Week</option>
<option value="month">Last Month</option>
<option>Last Quarter</option>
<option value="year">Last Year</option>
<option value="">Overall</option>
<option value="custom">
Custom
</option>
</select>
{this.state.isOpen && (
<DateRangePicker
value={this.props.value}
onSelect={this.props.change}
singleDateRange={true}
isOpen={false}
maximumDate={new Date()}
closeCalendar={true}
numberOfCalendars={2}
showLegend={true}
locale={originalMoment().locale()}
/>
)}
</div>
);
}
}
export default Filter;
onClick event is not working on Android Chrome
Here's a fiddle using jQuery.
$('#btn').on('touchstart click', function() { var cupon = $('#btn').attr('val1'); var link = $('#btn').attr('val2'); var copyText = document.createElement("input"); document.body.appendChild(copyText); copyText.setAttribute("id", "copyTextId"); copyText.setAttribute('value', cupon); copyText.select(); document.execCommand("copy"); document.body.removeChild(copyText); alert("Cuponul " + "'" + copyText.value + "'" + " a fost copiat. Spor la cumparaturi! :)"); window.open(link);});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><button id='btn' val1='test to copy' val2='http://www.google.ro'>Copy coupon</button>
OnClick event doesn't work in my chrome extension
In Chrome extensions, inline code is forbidden. You cannot use onclick
attribute at all for extension scripts, and CSP cannot be relaxed.
You will have to use addEventListener
to make it work. It's not hard, and covered in the documentation linked above.
var setButton = "<button type='button' id='setter2' onclick=Set_one(this.id)>set</button>";
var str = getRow.insertCell(-1);
str.innerHTML = setButton;
document.getElementById("setter2").addEventListener("click", function() {
Set_one(this.id);
});
It's even better though if you don't use innerHTML
assignment and directly create/append elements:
var setButton = document.createElement("button");
setButton.textContent = "set";
setButton.id = "setter2";
setButton.addEventListener("click", function() {
Set_one(this.id);
});
getRow.insertCell(-1).appendChild(setButton);
Click events are not working in Chrome, but event fires when we execute it manually from console
Answer
Since the user laptop was "HP Elitebook 840",it was touch screen enabled.
So solution was disabling the touch screen
1.Type below in chrome browser :
chrome://flags/#touch-events
2.In the enable touch events section ,please select "Disable" from the drop down.
3.Click on "Relaunch Now"
onclick is not working in chrome app?
You cannot add inline JavaScript in Chrome Extensions. Instead, you need create an external JavaScript file where you can add the event listener. Something like this:
document.addEventListener('DOMContentLoaded', function() { document.getElementById('disable-button').addEventListener('click', function() { document.getElementById("btn01").disabled = true; });});
<!DOCTYPE html><html><body> <form> <input type="button" id="btn01" value="OK"> </form>
<p>Click the "Disable" button to disable the "OK" button:</p> <button id="disable-button">Disable</button></body></html>
Onclick function is not working in Chrome browser
I have another suggestion
<select onchange="valueChanged(this.value);" name="Consolidate Report" class="input">
<option value="">Consolidate Report</option>
<option value="view_graph" >View Graph</option>
<option value="export_graph">Export Excel</option>
</select>
<script>
function valueChanged(value){
if(value == 'view_graph')
{
alert('view_graph');
}else if(value == 'export_graph')
{
alert('export_graph');
}
}
</script>
Dynamic onclick isn't working in chrome
Please check with this: https://jsfiddle.net/qubfcc7z/34/
The problem is: function $(document).on('mouseover', '.item-block-row' is run a lot of time
if(($(this).closest('#glaceblock').length || $(this).closest('#sorbetblock').length) && $(this).find('.deleteSorbGlaceItem').length ===0){
Related Topics
Redirect to Url After Form Submit in React
How to Calculate the Sum of Table Column in Angular 2+
Reprompt for Permissions With Getusermedia() After Initial Denial
How to Add Pm or Am Based on Hour from Input
How to Pass Data from Flask to JavaScript in a Template
React Native How to Call Multiple Functions When Onpress Is Clicked
How to Look for Changes in Localstorage in Angular 4
How to Disable and Enable a Click Event on a Table Td
Validation Using Yup to Check String or Number Length
Change Name of Uploaded File on Client
Calculate Total Sum of Dynamically Added Items to a Table
For Loop With Two Array in JavaScript
Regular Expression to Accept Both Positive and Negative Numbers
How to Change Background Opacity When Bootstrap Modal Is Open
How to Detect If Two Divs Are Touching/ Collision Detection
How to Take Screenshot of a Div With JavaScript
Ngoninit Not Being Called When Injectable Class Is Instantiated
Count Total Number of Checkboxes What Are Checked and Show on Page Via Js