Here is the demo link
Note: This demo is static in reality there will be dynamic list and button functionality.
On hover of item two buttons are showing.
Problem:
I want to programmatically hover each of the items and click on button using JS. This is a third party website UI demo and I want to handle it using my Chrome's console tab, if that's possible.
CSS:
.row .actions {
display: block;
position: absolute;
top: 0;
right: 0;
height: 44px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 8px 15px 8px 2px;
}
HTML:
<ul id="list">
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
JQuery:
$("#list li").hover(
function() {
$(this).append('<button id="but1" onclick="button1()">Button1</button>' +
'<button id="but2" onclick="button2()">Button2</button>');
},
function() {
$('#but1').remove();
$('#but2').remove();
});
function button1(){ console.log("button1") }
function button2(){ console.log("button2") }
$0:hover, as far as I read around, requires you to dispatch the mouseenter event to the element. It isn't that far from a solution after all. The$0strategy is something I found out not very long ago and was a big surprise to see. It's sad to say that js-wise I still think chrome is another planet. I force myself using firefox as much as I can but sometimes it's really a pain (for me)$('whatever-selects-the-element').trigger('mouseover')should do the trick.