how to make div click-able?

Give it an ID like “something”, then: var something = document.getElementById(‘something’); something.style.cursor=”pointer”; something.onclick = function() { // do something… }; Changing the background color (as per your updated question): something.onmouseover = function() { this.style.backgroundColor=”red”; }; something.onmouseout = function() { this.style.backgroundColor=””; };

Combine hover and click functions (jQuery)?

Use basic programming composition: create a method and pass the same function to click and hover as a callback. var hoverOrClick = function () { // do something common } $(‘#target’).click(hoverOrClick).hover(hoverOrClick); Second way: use bindon: $(‘#target’).on(‘click mouseover’, function () { // Do something for both }); jQuery(‘#target’).bind(‘click mouseover’, function () { // Do something for … Read more

Javascript Click on Element by Class

I’d suggest: document.querySelector(‘.rateRecipe.btns-one-small’).click(); The above code assumes that the given element has both of those classes; otherwise, if the space is meant to imply an ancestor-descendant relationship: document.querySelector(‘.rateRecipe .btns-one-small’).click(); The method getElementsByClassName() takes a single class-name (rather than document.querySelector()/document.querySelectorAll(), which take a CSS selector), and you passed two (presumably class-names) to the method. References: document.getElementsByClassName(). … Read more

Need to cancel click/mouseup events when double-click event detected

This is a good question, and I actually don’t think it can be done easily. (Some discussion on this) If it is super duper important for you to have this functionality, you could hack it like so: function singleClick(e) { // do something, “this” will be the DOM element } function doubleClick(e) { // do … Read more

How to click an element in Selenium WebDriver using JavaScript?

Executing a click via JavaScript has some behaviors of which you should be aware. If for example, the code bound to the onclick event of your element invokes window.alert(), you may find your Selenium code hanging, depending on the implementation of the browser driver. That said, you can use the JavascriptExecutor class to do this. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)