click

Jquery if its the first time element is being clicked

我们两清 提交于 2019-12-04 05:05:58
I need my script to do something on the first time an element is clicked and continue to do something different on click 2,3,4 and so on $('selector').click(function() { //I would realy like this variable to be updated var click = 0; if (click === 0) { do this var click = 1; } else { do this } });//end click really I think it should rely on the variables but I can't think of how to update the variable from here on out any help would be awesome. Have a look at jQuery's .data() method. Consider your example: $('selector').click(function() { var $this = $(this), clickNum = $this.data('clickNum');

Clicking on a hypertext link using XPath

ぃ、小莉子 提交于 2019-12-04 04:49:57
问题 Apologies if this is a dumb question - I'm new to Selenium. I have a web page I'm testing that has a few hypertext links in a table. The HTML looks like this: <table> <thead> <tr> <td><b>History</b></td> <td><b>Attributes</b></td> <td><b>Xml</b></td> </tr> </thead> <tbody> <tr> <td><a href=link here>Show</a></td> <td><a href=link here>Show</a></td> <td><a href=link here>Show</a></td> </tr> </tbody> </table> I want to test a click on each of the 'Show' links. They all have the same text, so I

Sending mouse or touch events to VirtualBox VM from host shell?

三世轮回 提交于 2019-12-04 04:48:11
问题 I know how to send keyboard events (keystrokes) to a VirtualBox Virtual Machine, using VBoxManage controlvm keyboardputscancode <scancode> <scancode> <etc...> Is there a similar way to simulate mouse or touch events ? For example, move the mouse to a certain coordinate or over a certain distance, or send a mouse click, or send a touch/tap on a given coordinate? 回答1: You can do this using Python from vboxapi import VirtualBoxManager mgr = VirtualBoxManager(None, None) vbox = mgr.getVirtualBox(

How can I differentiate between single and double clicks in .Net?

China☆狼群 提交于 2019-12-04 04:43:42
I want to override OnMouseClick and OnMouseDoubleClick and perform different actions depending on which click style was used. The problem is that OnMouseClick is happening for both single and double clicks, and is getting called before OnMouseDoubleClick. I'm certain this must be a common requirement, so I guess I'm missing something pretty obvious. Can someone fill me in? Edit to add: the MouseEventArgs.Clicks count doesn't help. In the case of a double-click, the first click is handled as a single click in OnMouseClick with MouseEventArgs.Clicks == 1. Edit to add: the objects are image

Click on given element in canvas

坚强是说给别人听的谎言 提交于 2019-12-04 03:58:35
问题 Is there any trick to determine if user clicks on given element rendered in canvas? For example I'm displaying rhombus from .png file with transparent background and i want to know if user click inside or outside that figure (like mouse-element collision). 回答1: There is no concept of individual elements in a canvas - it is simply just an area that you're drawing pixels onto. SVG on the other hand is made up of elements which you can then bind events to. However there are a few approaches you

Programmatic button click throws 'System.StackOverflowException' exception

本小妞迷上赌 提交于 2019-12-04 03:52:29
I have written a WinForms program in C#.Net to click a button programmatically within a password form. Form1 loads and shows Form2 as a dialogue box. The application will close if DialogResult is anything other that DialogResult.OK. So far I have a button click event, which is coded as follows: if (txtpass.Text == "") { MessageBox.Show("You need to enter a password", "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtpass.Focus(); } else { if (txtpass.Text == "1234") { radButton1.DialogResult = DialogResult.OK; radButton1.PerformClick(); } else { MessageBox.Show("Password Incorrect

jquery redirect on click or after 10 seconds

空扰寡人 提交于 2019-12-04 03:51:22
问题 I have a spash screen on a website that has a div with the ID of "splash" i'm trying to make the div fade in then if the user clicks on the div it fades out and redircts to the main site. If the user dosen't click it just fades out and redirects after 10 seconds. The timed redirect is working but not the click function. <script type="text/javascript"> $(document).ready(function() { $('#splash').hide(); $('#splash').fadeIn(1000, function() { $(this).delay(10000).fadeOut(1000, function() {

Stop click propagation from Ember action?

筅森魡賤 提交于 2019-12-04 02:47:13
问题 I have this code that when icon-edit span is clicked, it fires an action that opens a modal, however, at the same time, the click propagates to the view below it (personView). I want the action to execute and stop the propagation. The only solution I can think of is to make the icon-edit its own view and stop the click propagation by returning false in method click. Is there any other way of doing this without making another view? HBS: {{#view Blocks.PersonView}} <span class="inline pull

When a mousedown and mouseup event don't equal a click

匆匆过客 提交于 2019-12-04 02:37:21
I've been using some buttons for a while now that have a depressed effect as they are clicked using position relative and a top: 1px in the :active pseudo-class. I had problems with click events not firing and it turned out to be due to the mousedown and mouseup events not firing on the same element. I did a bit of fiddling to make sure the inner-most element covered the whole button and discovered that the issue remained. If I click right at the top of the text then the link jumps down (firing the mousedown event) and then back up (firing the mouseup event) but the click does not occur. If I

XPath not working to click a button from a Greasemonkey script

会有一股神秘感。 提交于 2019-12-04 02:04:12
问题 I would like to open a link that contains the word google . It looks like this: <input class="submit" style="background: #409999; border-radius: 10px;" value="open" onclick="Open('143615', '1', 'https://www.google.de/');" type="submit"> I tried this Greasemonkey code: var snapResults = document.evaluate("//input[contains(@onclick, 'test')]",document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = snapResults.snapshotLength - 1; i >= 0; i--) { var elm = snapResults