click

How to set a breakpoint on clicking a 3rd party button?

送分小仙女□ 提交于 2019-11-30 14:57:01
问题 I'm trying to debug a 3rd party widget (+1 button to be exact). Specifically, I'd like to set a breakpoint in Chrome that stops when a button in the widget is clicked. I would like to break on the 3rd party code that handles to click event. Is there a Chrome extension (or something else I haven't thought of) to help me find the right place in the code to break on? 回答1: You can make use of Chrome's Developer Tools; no extension is required. I made a +1 button example here: http://jsfiddle.net

Android button click to play music, click again to stop sound

本秂侑毒 提交于 2019-11-30 14:25:26
问题 I have a button, when I click it plays music, how to do it, when I click second time, to stop the music? Button two = (Button)this.findViewById(R.id.button2); final MediaPlayer mp2 = MediaPlayer.create(this, R.raw.two); two.setOnClickListener(new OnClickListener(){ public void onClick(View v) { mp2.start(); } }); Ok, this one works: Button one = (Button)this.findViewById(R.id.button1); final MediaPlayer mp1 = MediaPlayer.create(this, R.raw.n); one.setOnClickListener(new OnClickListener(){

Browser-friendly way to simulate anchor click with jQuery?

℡╲_俬逩灬. 提交于 2019-11-30 14:23:58
问题 I'm trying to simulate a click on an anchor tag using jQuery. I've been digging around StackOverflow and Google for a while and haven't found anything that works on all of the browsers I'm testing. So far, I've found this: $(document).ready(function() { $.fn.fireEvent = function(eventType) { return this.each(function() { if (document.createEvent) { var event = document.createEvent("HTMLEvents"); event.initEvent(eventType, true, true); return !this.dispatchEvent(event); } else { var event =

Assigning click event to dynamically added buttons

社会主义新天地 提交于 2019-11-30 13:08:35
问题 I am creating some buttons dynamically and assigning them IDs. When ever someone clicks that button I want to collect the ID and from there perform some task. Here's my work in progress $(document).ready(function() { $('input:button').addClass("btnClass"); fillData(); $('#btnGet').click(function() { fillData(); }); function fillData() { $.ajax({ type: "Post", url: "../Linq/myService.asmx/getStudent", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { /

How do you make Greasemonkey Click a link that has specified text?

僤鯓⒐⒋嵵緔 提交于 2019-11-30 13:06:55
Alright basically i want to click a link that changes but always has the same text name. Heres an example of what the code might be <a href="unlock.php?confirm=MD5hashere">Click Here</a> Brock Adams Here is a starter script that does that. Note that it uses jQuery and assumes you are running Firefox or using Tampermonkey, if you are on Chrome. // ==UserScript== // @name _YOUR_SCRIPT_NAME // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work

How to send multiple arguments to jQuery click function?

一个人想着一个人 提交于 2019-11-30 12:53:16
Currently I'm using something like: $('.myclass').click(function(){ var msg = $(this).attr('id'); alert(msg) }); And HTML: < a href="#" class="myclass" id="101">Link</a> If I need additional parameters how would I read them? Also is the current way I am using the proper way? Originally I was using hidden input fields so it was already a step up. :p ChaosPandion jQuery Events jQuery .click() $('.myclass').bind("click", { Param1: "", Param2: 2 }, function(event){ alert(event.data.Param2); }); you can use bind() and send additional data to the event handler as event.data this may not be the best

How to set a breakpoint on clicking a 3rd party button?

▼魔方 西西 提交于 2019-11-30 12:41:41
I'm trying to debug a 3rd party widget ( +1 button to be exact). Specifically, I'd like to set a breakpoint in Chrome that stops when a button in the widget is clicked. I would like to break on the 3rd party code that handles to click event. Is there a Chrome extension (or something else I haven't thought of) to help me find the right place in the code to break on? You can make use of Chrome's Developer Tools; no extension is required. I made a +1 button example here: http://jsfiddle.net/rPnAe/ . If you go to that fiddle and then open Developer Tools (F12), then go to Scripts and expand Event

jquery click on anchor element forces scroll to top?

时光总嘲笑我的痴心妄想 提交于 2019-11-30 12:01:28
问题 jQuery hyperlinks - href value? text][1] I am running in to a problem using jquery and a click event attached to an anchor element. [1]: jQuery hyperlinks - href value? "This" SO question seems to be a duplicate, and the accepted answer doesn't seem to solve the problem. Sorry if this is bad SO etiquette. In my .ready() function I have: jQuery("#id_of_anchor").click(function(event) { //start function when any update link is clicked Function_that_does_ajax(); }); and my anchor looks like this:

jQuery/Javascript: Click event on a checkbox and the 'checked' attribute

一世执手 提交于 2019-11-30 11:51:35
The code: $('input.media-checkbox').live('click', function(e){ e.preventDefault(); var that = $(this); if (that.attr('checked') == 'checked'){ var m = that.attr('media'); var mid = 'verify_' + m; that.parents('div.state-container').find('ul.' + mid).remove(); that.attr('checked', false); } else { var url = AJAX_URL; $.ajax({ type: 'GET', url: url, dataType: 'html', success: function(data){ that.parents('li').siblings('li.verification').children('div.media-verification').append(data).fadeIn(500); that.attr('checked', 'checked'); } }); } return false; }); I am ajaxing in a form, then firing the

jquery click event is firing multiple times when using class selector

独自空忆成欢 提交于 2019-11-30 10:52:44
here is my html <li><div class="myLink" id=1>A<div> <li><div class="myLink" id=2>b<div> <li><div class="myLink" id=3>c<div> <li><div class="myLink" id=4>d<div> <li><div class="myLink" id=5>d<div> <li><div class="myLink" id=6>e<div> <li><div class="myLink" id=7>d<div> <li><div class="myLink" id=8>g<div> i created a jquery event bind wiht this code: jQuery(".myLink").click(function(event) { var myId = this.id; location.href = '/x/y?myId=' + myID; }); when i click on one of the links (the li items). i thought that would fire one click event and when i call this.id, i would just get that id of the