click

d3 Click to create circle and click to remove

那年仲夏 提交于 2019-12-02 00:39:40
I am trying to click on a circle to remove it, but clicking on the canvas will create a circle. I do want to actually remove the circle and it's object from the data, as opposed to just making it transparent. On click on a circle calls the function function removeElement(d) { d3.select(this) .remove(); } This function is called with a basic click on the circle, .on("click", removeElement); I think I'm not correctly distinguishing between clicking on the canvas to create a circle where none exists and clicking on an existing circle to remove it. <!DOCTYPE html> <meta charset="utf-8"> <style>

click() firing multiple times

拈花ヽ惹草 提交于 2019-12-02 00:28:09
问题 I am using a document.getElementById("val").click() to invoke a click event, but it keeps firing multiple times. Here I add the eventHandler: try { //add mousedown event handler to navigation buttons addEventHandler(oPrevArrow, "mousedown", handlePrevDayClick); addEventHandler(oNextArrow, "mousedown", handleNextDayClick); addEventHandler(oLogout, "mousedown", handleLogoutClick); } catch (err) { } In the click event I am performing a "auto click" function handleNextDayClick(e) { e = e ||

第八次作业-1

怎甘沉沦 提交于 2019-12-02 00:20:48
package com.example.chongzhilianxi; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } //点按钮开启第二个窗口 public void click(View v){ Intent intent=new Intent(this,SecondActiviy.class); startActivityForResult(intent, 1); } @Override protected void onActivityResult(int

Jquery Onclick not happening second time

大憨熊 提交于 2019-12-01 23:39:11
问题 I'm a bit confused as to why this isn't working; I assume that because I'm adding the class and its not being added back into the collection I'm not sure. Here it is on a jsbin http://jsbin.com/ayije although code is below also. Either way I can only get the action to happen on an element once. <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function () {

Clicking on a hypertext link using XPath

爱⌒轻易说出口 提交于 2019-12-01 23:30:01
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 can't reference them by linktext. I've been referencing them by XPath, so that: driver.findElement(By

jQuery events: prepend a callback handler to already existing ones

删除回忆录丶 提交于 2019-12-01 23:27:50
问题 On a web page are elements with click and/or keypress handlers. If I add a new one it would be executed after them. I need a way to add a new callback which is prepended to the event handler list, so that it is executed beforehand. How is that possible with jQuery? Update Why can't I just use jQuery's unbind method? I am injecting my jQuery code to any web page, so that i don't know if any and which JavaScript framework is used. I need a universal way to detect event handlers and prepend mine

iPhone jQuery click event

隐身守侯 提交于 2019-12-01 22:31:12
问题 I have a simple click event attached to a number of anchors on my web app. $('a.heading').live("click", function(e) { e.preventDefault(); //do my stuff }); It's not rocket science. However on my iPhone the click doesn't register. It would appear it uses the touch handler for iPhone (iPad, Android etc are all fine). I've seen a couple of tutorials but cannot seem to get my head around it. Is there not a one liner that I can use that jQuery is so usually good at? 回答1: This did the trick: var

click() firing multiple times

筅森魡賤 提交于 2019-12-01 22:21:30
I am using a document.getElementById("val").click() to invoke a click event, but it keeps firing multiple times. Here I add the eventHandler: try { //add mousedown event handler to navigation buttons addEventHandler(oPrevArrow, "mousedown", handlePrevDayClick); addEventHandler(oNextArrow, "mousedown", handleNextDayClick); addEventHandler(oLogout, "mousedown", handleLogoutClick); } catch (err) { } In the click event I am performing a "auto click" function handleNextDayClick(e) { e = e || window.event; stopEvent(e); document.getElementById("btn_nextday").click(); } I need help to figure out what

Jquery 'click' not firing when icon is on button

风流意气都作罢 提交于 2019-12-01 22:18:44
问题 I use Bootstrap and jQuery . I have three buttons, each with an icon in it. When I bind an click -event to a button, it works when I click on the button (on the edge), but not when I click on the middle of it, on the icon... My code looks like this: <div class="btn-group"> <button class="btn btn_change_status" id="134" rel="tooltip" data-original-title="Tooltip"> <i class="icon-eye-open"></i> </button> ... </div> ... $('button.btn_change_status').on('click', function(e) { alert(e.target.id);

Jquery Onclick not happening second time

为君一笑 提交于 2019-12-01 20:38:35
I'm a bit confused as to why this isn't working; I assume that because I'm adding the class and its not being added back into the collection I'm not sure. Here it is on a jsbin http://jsbin.com/ayije although code is below also. Either way I can only get the action to happen on an element once. <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function () { $('.optional').click(function () { $(this).removeClass('optional').addClass('selected'); return false;