FAQ Database Discussion Community


How to get other views in same ViewHolder at same position as the onClicked view (use in a RecyclerView Adapter)

android,onclick,recyclerview
I have a RecyclerView in my app that displays a row containing pictures and photographs downloaded from the internet. There is a photo and a button on screen. When the user clicks a button, I want to make another view visible on top of the on screen photo. I have...

Use jQuery click function with javascript OnClick

javascript,jquery,ajax,scroll,onclick
I want to use : $("...").animate() with loading an onClick JavaScript Ajax . But there are some issues with that: I try using jQuery like this : function Ajaxrequest(){ var xmlHttp;try{xmlHttp=new XMLHttpRequest();return xmlHttp;} catch (e){ try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); return xmlHttp; } catch (e){ try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); return xmlHttp;} catch (e){ alert("Browser Not...

No action clicking on Bootstrap popup

javascript,jquery,onclick,bootstrap,popupwindow
I need to implement a pop up window on clicking one link. My HTML Code snippet: <head> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript" src="/stylesheets/script.js"></script> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script...

FadeIn 1000 when add class by Click

jquery,html,onclick,click
I'm trying to fadeIn 1000 when add class by Click function. I have tried this: http://jsfiddle.net/rf7mudL5/ HTML <span class="date-outer">Text will Red on fadeIn</span> <button class="more-recent-button"></button> JS $(".more-recent-button").click(function(){ $(".date-outer").fadeIn("1000").addClass("more-date-outer"); }); So how to opacity fadeIn when Class will add by click button? Is possible this: when click button, content will fadeIn...

disable right click in javascript

javascript,onclick,mouseevent
When I was trying to disable the right click, it is not working. I tried with below code. document.onclick = function(e) { console.log(e.button); if(e.button == 2){ e.preventDefault(); return false; } } Based on below link only I tried. Disable Right Click in website I tested this code in Chrome and...

Bind scroll to on click event

javascript,jquery,scroll,onclick
I've got a downArrow and upArrow buttons on my page to control scrolling. When scrolled to the bottom of the page, the down arrow disappears; and the up arrow disappears when scrolled to the top. Everything works perfectly. Question: How do I bind the mouse wheel scroll to my on...

Using a Spinner to Change webView

android,webview,onclick,spinner
I have an app that sends a user input to a website's search URL, like so: To do this, I was wondering: How do I store the last webpage visited on each site to cache? How should I add the website names to the spinner? How would I write the...

ReactJS component onClick not firing own function

javascript,web,onclick,reactjs
I started this component with all the <th> hard coded in, but realized it would save me some time putting them in an array and calling it before render. But now the onClick event isn't firing. I added in the <th id="category" onClick={this.handleClick}>test cat</th> to show that this still works....

I am having trouble with resetting the counter in jquery (clickfunction)

javascript,jquery,html,onclick
I am trying to repeat the clickfunction but it will only repeat twice. After that the counter disappears. I don't know what the cause of this is. H var divClone = $("#target").clone(); var divClone = $("#output").clone(); var clickCount = 0; $('#target').click(function() { if ( clickCount < 6){ clickCount++; $('#output').html(function(i, val)...

onClick priority over addEventListener in javascript?

javascript,onclick,handler,addeventlistener
Right now, I have an event listener that listens to a click on the screen. There is also a button on the screen. When I click on the button the event listener will execute before the onclick. Is there a way I can make onclick have higher priority? <script> document.body.addEventListener('click',function(){alert('1');},...

Set onclick to item that isn't visible

android,listview,onclick,cursor,adapter
So I have been looking around for about 4 hours now and maybe I just don't know how to word my search, but I am not finding out what I need. I am using a custom adapter to setup my listview from items I have stored into an sqlite database....

can i have an onclick event on a imagemap area element

javascript,jquery,onclick,area,imagemap
I would like to put an onclick event on an area element. Here is my setup: <img id="image" src="wheel.png" width="2795" height="2795" usemap="#Map" > <map name="Map"> <area class="blue" onclick="myFunction()" shape="poly" coords="2318,480,1510,1284" href="#"> </map> I have tried 2 different ways to have an onclick event. Firstly i tried this: $(".blue").click( function(event){ alert('test');...

show span in html with a javascript function with onclick involving random generator

javascript,html,function,onclick
I apologize if the title sounds a little confusing, essentially, I am trying to figure out how to get a span to appear and/or swap depending on a random generator. in one of my classes involving riddles, I was able to get the text to disappear and reappear upon clicking...

Save Textbox.text to a new Batchfile on my pc by button click

c#,winforms,batch-file,onclick
How can i click a button on my c# winform and make it save the contents of my textbox to a new batch file on my pc must save as a .bat and be able to open in windows8 as a .bat I have tried many solutions but none work...

Jquery click doesn't work on append

jquery,onclick,click,append
I'm trying to use the JQuery .click on a div that i append, but the click doesn't work at all. here is the code, i already tried the help from the other Tutorials i could find on the internet but it didn't work. here is the jquery (very simple version)...

ListView item onClick can't show wanted result

java,android,xml,listview,onclick
This is the listview. It only shows 3 type of info(i.e. job post name, location, salary) in each item : Job post name 1 Location 1 Salary 1 For example, the above 3 info is item 1 in the listview. If I click item 1, it is supposed to show...

How do you create a button that will display a random result from an array in javascript?

javascript,arrays,button,random,onclick
I've been trying to create a button that will take a random name from an array, and display it on an html page. Been trying for a long while to get this to work, with no results. What gives? As well, if you know the answer, how could I create...

link onclick vs. button onclick

jquery,html,onclick,section508
This is a fairly simple accessibility question. Say we have a toggle link/button which, when clicked, toggles the mobile menu. Which is the more accessible format for such a button? We have 4 total options, separated by button tag vs. a tag, and onclick attribute vs. $("#showMenu").on("click", function() { showMenu()...

Setting the onclick event to a custom function results in syntax error

javascript,javascript-events,onclick
Given the following example code I want to set the onclick event to a function which I declare in the same method (no function in global scope): <HTML> <HEAD> <Title>Title</Title> </HEAD> <body> <img id="img" class="std" src="http://www.free-animated-pictures.com/bug_crawls_on_screen.gif"/> <script type='text/javascript'> var i = document.getElementById("img"); var func = function(){ var i = document.getElementById("img");...

JS Scroll Event not firing up

javascript,php,scroll,onclick
I've tried overwriting the scroll-to-id-event with a js-function I found online (Smoothly scroll to an element). For unknown reasons it wont fire up. Js itself is correctly implemented, as I managed to output some text with document.print('test'); Im really really not into Js, so please be patient with me. Index.php:...

Change Font Awesome Icon on Click, but return to original icon when next item is clicked

jquery,twitter-bootstrap-3,onclick,font-awesome,toggleclass
I'm using Bootstrap 3 Panel's and have appended the Font Awesome Plus and Minus icons to the panel items. I'm looking for a way using Jquery to change the plus to a minus "onClick", then when another panel item is clicked I want that minus icon to change back to...

Using required and readonly attributes together

html5,button,onclick,readonly,required
I'm creating an HTML5 web form. One of the inputs is for geolocation and it is filled by clicking on a button (it inserts gps coordinates). Since this input has to be required and has to be read-only (i do not want that users write custom data inside), how to...

jquery solution / javascript function assign variables

javascript,jquery,function,variables,onclick
i need function which assign selected value or variable to new variable and forward to input field. Anyone can help me? :> <script> function myFunction(){ //function } </script> <input id="price-postfix1" onclick="myFunction()" name="price-postfix" type="radio" value="$option1"/>Option1<br> <input id="price-postfix2" onclick="myFunction()" name="price-postfix" type="radio" value="$option2"/>Option1<br> <input id="price-postfix3" onclick="myFunction()" name="price-postfix" type="radio"...

keep the hover effect on click

css,onclick,hover
i want to keep the hover effect of my div when i click on it how can i do it ? There is my code: i actually want my div with the red background stay in the hover place when i click on the "work" button #work_btn{ position:absolute; top:60%; left:60px;...

RecyclerView onItemClicked callback

android,onclick,onclicklistener,recyclerview,android-recyclerview
I am implementing a Navigation Drawer with a RecyclerView, using this tutorial, but I don't want to apply the whole tutorial, I just want to handle the user's click. I've implemented the onClickListener inside the ViewHolder of my MyAdapter class: public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{ int...

Difference between saving an element to a variable and just calling document.getElementByID()

javascript,html,onclick,buttonclick
I realize the title doesn't make a lot of sense, but I'm not sure how else to express the question I have. I am trying to learn about adding events to buttons in JavaScript, and I have run into a bug that I cannot figure out. Here are the two...

Android Drawer – Change Icon onClick

android,listview,onclick,icons,navigation-drawer
I have got a simple navigation drawer with a header (see picture). What I want to do now is whenever the header (listview-item with position 0) is clicked to either change the down-arrow-icon (bottom right corner of header) to an up-arrow-icon or to rotate it so the arrow points up....

show/hide multiple div tags at once and change the size of the remaining div tag

html,css,onclick,hide,show
I have four 200px*200px div tags and when I click one I would like to change the one I clicked to 800px*800px and hide the other three div tags. I would like to be able to do this to each of them, so say when I click one it will...

adding and remove classes on click events

javascript,jquery,html,onclick
I am working on a click event, which intially is pretty standard. on.click: Remove the active class from all list items, then add active to the clicked list item. ie var li = $('.child-item'); li.click(function(){ li.removeClass('active'); li.addClass('active'); }); Works as expected. However, I also need a condition that if the...

How to add a class to an element that is outside of your onclick element

javascript,jquery,if-statement,onclick
I need some help with some If statement. I have this div <div id="features-dots"> <ul> <a href="#"><li class="one"></li></a> <a href="#"><li class="two"></li></a> <a href="#"><li class="three"></li></a> </ul> </div> and <div class="feature_thumb"> <a class="feature_thumb" id="one" onclick="return false;"></a> </div> <div class="feature_thumb"> <a class="feature_thumb" id="two" onclick="return...

detect listItem from button click

android,listview,button,onclick,position
I have a listView with an adapter. Every item has two buttons, and i need to detect from which listItem the button was pressed. Here is my code: List<String> mList = new ArrayList<>(Arrays.asList(mNames)); ArrayAdapter<String> mAdapter = new ArrayAdapter<String>( getActivity(), R.layout.list_item_friends_new, R.id.friends_new_name, mList ){ @Override public View getView(int position, View convertView,...

I want to add my editbox data to a local table?

android,onclick,smartface.io,editbox
How can I add a data to a local table from editbox. I have done many changes to my code onButton click. I have added this code Data.execute("insert into Sample_Table values('Name')",Pages.Page1.EditBox1.text); alert(Pages.Page1.EditBox1.text); But my data is not added in Sample_Table. How can I add data to it if anybody can...

I can't retrieve the value typed in a text input using Javascript

javascript,onclick,bootstrap
I have a problem, when i try to retrieve the value I have typed in the text input, and I try to print it in alert , it shows nothing, the variable is empty here is the code: I have here the input textfield 'Montant', i would like to retrieve...

Change ImageView src from it's own onClick() method

android,onclick,imageview
I'm making a simple Whack a mole game, and when a user taps on a mole, I want it to turn into a poof before it disappears. To do this, I'm trying to call setImageResource() from inside the onClick(), but onClick gets passed a View, which doesn't define setImageResource(). Casting...

Is it possible to call the mainActivity class of another project ?

java,android,button,onclick,main-activity
I have 3 android projects, which they have different functions. Each project has its own mainActivity class. Now I want to merge the 3 projects into one. I can think of 2 ways to do it. First way: open one of the 3 projects, then create new java class and...

Write onclick method that has parameters in php print function

javascript,php,printing,onclick
I'm having problems with writing an onclick method in php print in code below: <?php print "<p><small> <a href='#' onclick='ajaxMenu('comments.php?news=".$fileContent['id']."');>".$number. " ".$text." </small> </a> </p>"; ?> Given code doesn't work. I believe it's because of combination of single and double quotes in it. Can anyone help me to solve this?...

Change input value when i press Attribute

php,forms,search,onclick,submit
Ok guys already search for it but no results at all, and cant figured it out how to do this, so my problem is: I have this form: <form method="POST" action="search.php" name="form" id="form"> <input type="text" name="search" id="search" placeholder="Introduza a sua Localização"> <input type="submit" name="Submit" value="Pesquisar"> </form> And what i would...

Return the position clicked in recyclerview in a different Activity?

android,onclick,position,recyclerview
I have a recylcerview in a navigation drawer and I wish to find what position was clicked by the user in the recyclerview in a different activity. The way I have written the code currently always return 0 as the position. Can anyone help me out. Thanks in advance! Recyclerview...

error: /home/retok/proj/src/com/hellow/app/HelloActivity.java:34: ';' expected

java,android,methods,onclick,onclicklistener
I'm trying to make Android onClick() method easier to read, so I wrap it like this public void click(Button bt) { bt.setOnClickListener(new View.OnClickListener() { public void onClick(View v) {} }); } When I try to run it like this button = (Button) findViewById(R.id.btn1); click(button) { @Override public void onClick(View v)...

I have an image I would like to use to control an

html5,onclick,html5-audio
So, I have an audio track autoplay when opening the website <audio class="topper" autoplay loop id="minuscolo"> <source src="media/minuscolo.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> and I have an image that I would like to use to control the music <img class="hvr-shrink square" alt="Pause" src="media/gogh.png" onclick="document.getElementById('minuscolo').pause()"> I...

Is there an event for onclick end?

javascript,jquery,html5,javascript-events,onclick
I have a code in which should only be executed after an onclick event. On mobile devices its fine because I use touchstart and touchend. Is there an event similar to touchend for use on a computer? My code currently looks similar to.. document.getElementById('trigger-box').addEventListener(function(e) { // the event will be...

Toggle inside onclick

jquery,onclick
I'm trying to work out how I can put a toggle inside an onclick of an img tag. i.e. <img src="..." onclick="IWANTITHERE" /> not using an event handler like so... $('img').toggle(function() {$(this).animate({width: '400px'}, 'slow');}, function() {$(this).animate({width: '120px'}, 'slow'); }); The following has some funky side effects like performing the animation...

Page is getting reloaded automatically on click event. Cannot determine why?

javascript,jquery,html,onclick
Have got an button in nav, which on click event is supposed to display:block an ul which is initially set to display:none HTML - <a href=""><i class="mdi-navigation-menu small right" id="lines3"></i></a> </nav> <ul class="collection center" id="drop-navv" style="display:none"> <li class="collection-item">Alvin</li> <li class="collection-item">Alvin</li> <li class="collection-item">Alvin</li> <li class="collection-item">Alvin</li> </ul> Js -...

Changing images using on click with arrays in javascript

javascript,html,onclick
When ever I try to click on the image, the image changes but the next image in the array is not displayed <!doctype html> <html> <head> <title> slides </title> <script type="text/javascript"> function nextslide(){ var images = new Array() images[0]= "home.jpg" images[1]= "left.jpg" images[2]= "right.jpg" var currentpic=0 var lastpic= images.lenth-1; if...

AngularJS Reactive Images (ng-class)

angularjs,onclick,ng-class,onhover
I have 3 variations of 1 image. I need to swap the image based on its Event State For Example: 'current' 'onClick' 'onHover'. Want to use standard Windows Events. Can I use Angular's 'ng-class' with IMAGES and add in onClick & onCover as my Javascript test expression? Precisely testing for...

javascript foreach onclick

javascript,foreach,onclick
<? foreach($words as $word): ?> <li> <button onClick="reply_click()">Show</button> <h4><?php echo $word['Word']['en_words'] ?></h4> </li> <? endforeach; ?> <script> function reply_click() { $("h4").toggle("slow"); } </script> When I click 'button' - shows all, in every foreach, but must show in only one. Where I must used 'this' that this script work? ...

Changing image source in JavaScript

javascript,image,dom,onclick,imagesource
I'm new to JavaScript, and I'm trying to alternate an image every click from 1st to 2nd and from 2nd to 1st(indefinitely). I tried this: function change() { var imgId = document.getElementById("image"); var ubuntu = imgId.src="ubuntu.jpg"; var debian = imgId.src="debian.jpg" if(imgId.src="ubuntu.jpg") { return debian; } else if(debian) { return ubuntu;...

React event-handling (onClick) inconsistency

javascript,onclick,event-handling,reactjs
Sup. The following alerts on render, but not onClick: render: function(){ return ( <div onClick={alert('I alert on render, but not onClick.')} /> ); } Same for the following: foo : function(text) { alert(text) }, render: function(){ return ( <div onClick={this.foo('I also alert on render, but not onClick.')} /> ); }...

How can I change the Background drawable of my button with onclick in Android?

android,button,onclick,drawable
I have a button with a drawable XML Background android:background="@drawable/greenbut" and i want to change the Background to my @drawable/yellowbut by make an onclick on my button. I tried it with this code, but it seems to be completely wrong. I cannot use the setBackground Function. Can you please help..?...

Windows Forms Chart: Get mouse cursor coordinates in Chart axis scale?

winforms,charts,onclick,position,coordinates
I have a problem with the following sample: When I click at the place marked as '1' on my screenshot, I can get position in pixels by MouseClick event in a pretty easy way: private: System::Void chart1_MouseClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) { Point chartLocationOnForm = chart1->FindForm()->PointToClient(chart1->Parent->PointToScreen(chart1->Location)); cursorPosX = e->X - chartLocationOnForm.X;...

Is doing $('#someId').click(function() on document.ready into thin air expensive?

javascript,jquery,onclick,document-ready
I have a website with some 25-30 different pages (pagetypes / templates, really, you probably get the idea). For each of these, I hook up stuff on $(document).ready(function() ...); and I simply wonder if all of these functions can be put in the same .js file which implies that many...

Listen onclick event in PyObjC

python,onclick,pyobjc
I try to display the current windows for each click on the system. I do this code : from AppKit import NSWorkspace def getwindows(): activeAppName = NSWorkspace.sharedWorkspace().activeApplication()['NSApplicationName'] print activeAppName return def main(): getwindows() main() But only the current windows when i setup the script is displayed. How can i bind...

How to get the index of css element inside 'click' event?

javascript,jquery,onclick
I have a group of images with thumb class. In the click event, I want to know which image the user clicked from the thumbs array of images. Basically, I want the index of (this) image in thumbs array. HTML <img class="thumb" src="#" /> <img class="thumb" src="#" /> <img class="thumb"...

Uncaught ReferenceError: is not defined onclick when using character strings

javascript,jquery,ajax,onclick
I am trying to pass a variable to the onClick function using a previously stored value. I have a database setup that searches for store locations when provided with a ZIP code. For example, the following link is generated using an ajax call after a user searches for a Zip...

Add onclick to a tag from javascript

javascript,forms,onclick
I am creating a form from javascript. I have to put the onclick on the a tag to call a method when clicked. I am doing like this, but it is not appearing the onclick. function remPass() { var log = document.getElementById("login"); var form = document.createElement('form'); form.method = "post"; form.action...

Error: Expected expression, got end of script

javascript,php,onclick,syntax-error
When clicking on the "Print Ticket" button Javascript is throwing an syntax error in firebug indicating "Expected expression, got end of script" However this is a straight forward bit of php/javascript code so i'm at a loss for the syntax problem. This button is not addressed by any Jquery function...

How to make an on/off switch using javascript?

javascript,html,onclick
so when a user clicks on a link a specific element should be shown and when the user clicks that link again the element should hide.I m trying do it but there's a problem with my code.It occurs just once.I want to occur for infinite times.Can anyone help? <html> <head>...

What's the scope of HTML body?

javascript,html,onclick,document-body
I'm learning Javascript. <input type="button" onclick="addP();"> This line works fine.Can I add click event to the body like this? <body onclick="addP();"> When I click ,I got nothing shows up.But if I add width and height to body, it worked! But just in the limited scope. If you add a background...

Javascript function that changes various images onclick of one image

javascript,image,onclick
I have searched and tried out various functions including 'if' and 'else' functions, but I can't get them to work.. The intention is to change various images onclick of just one image. Here is the HTML for that image I'm currently using: <div id="apDiv2"><a href="#" onclick="changeImg();"><img src="images/AJP-TAG-W.jpg" width="207" height="138" /></a></div>...

How do I launch the soft keyboard after “Cancel” button is clicked in DialogFragment?

android,view,onclick,android-softkeyboard,android-dialogfragment
Fragment.java file: .... public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.skyfrag_layout, container, false); getDialog().setTitle("Delete skycard"); Button btnCancel = (Button) rootView.findViewById(R.id.btnCancel); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getDialog().cancel(); } }); ... I tried each of the below in the onClick function but neither...

onclick redirection and lazy load

javascript,onclick,lazy-loading,primefaces-mobile
I want to run a javascript function when I click on a commandButton on signin.xhtml, but when I click on it, a redirection occur to dev.xhtml. I don't want this redirection, I want to stay on signin.xhtml. Actually it's not really a redirection because it's the same index.xhtml page but...

Assign an image resource to ImageView according to a flag

android,onclick,imageview,flags
I have to change the image dsiplayed in the ImageView, when user click on it. And when he clicks it again, I want to show the original image. How to do this with the flags? Supposably: imageView1, R.drawable.pic_one, R.drawable.pic_two. ...

How to add class to its parent div when clicked

javascript,jquery,wordpress,onclick
I am using this script in Wordpress hence the $=jQuery. This currently adds .current class to all .col-xs-4.col-sm-4.feature_thumb divs. How do I change this to only add the class to its parent's div? jQuery(document).ready(function(){ jQuery(".feature_thumb a").click(function(){ jQuery(".col-xs-4.col-sm-4.feature_thumb").addClass("current"); }); }); Can someone help me with this? This is my html <div...

Expand/shrink div on click

jquery,html,css,css3,onclick
i've been practicing some expand/shrink on click html/css/jquery, but some reason, it isnt working. I know there are some out there but i've tried them out, none is working with my code. PS: for now im trying to expand one My objective: Using 4 div squares, all are clickable (like...

How to stop MediaPlayer onPause() if i declare/start it inside the onButtonClick method?

android,onclick,media-player,android-mediaplayer,onpause
I am a noob programer and I encountered a problem, I have a mediaplayer.start() inside an onClick method, if i call mediaplayer.stop(); mediaplayer.reset(); mediaplayer.release(); it will crash and get the error: Attempt to invoke virtual method 'void android.media.MediaPlayer.stop()' on a null object reference ". I tried How to stop the...

listview item open activity

android,listview,onclick
I have an error when i click on item in activity they all show me the same string which his name: "name_0" the activity which is open when we click: public void handle() { TextView var3 = (TextView) this.findViewById(R.id.name); TextView var2 = (TextView) this.findViewById(R.id.meaning); TextView var5 = (TextView) this.findViewById(R.id.proof); Intent...

after onclick (which will call a function), it keep loading and cannot detect keypress

javascript,onclick
i am new in javascript, I am quite confuse to the following problem: Before i click the button, keypress can be detected and result in alert However, after i click the button, the page keeps loading and no longer detect my keypress anymore, I would like to ask why will...

JavaScript Function Call With OnClick

javascript,html,onclick
I have a simple function that works when it is hard coded, but when I try to pass a second parameter into it, it doesn't work. I am calling the function with the onclick and using the id => thumbnail to get the value. Any suggestions? Hard Coded Example (Works)...

Generate spans with ids using JavaScript

javascript,html,onclick
I have the following code which creates new spans with some input fields: function add_course() { var newspan = document.createElement('span'); newspan.innerHTML = 'Degree: <input type="text" name = "degree[]"> Course: <input type="text" name = "course[]">'; document.getElementById('degree_course').appendChild(newspan); } function add_skill() { var newspan = document.createElement('span'); newspan.innerHTML = 'Skill: <input type="text" name =...

Why onClick event not work on dojo MenuItem?

dojo,onclick,menuitem
I'm studying Dojo 1.10.4, my problem is that the onClick event does not work on dijit/MenuItem. I tried it on other item widgets like dijit/CheckedMenuItem and dijit/RadioMenuItem, none of their click events work, and the API docs didn't give any tips about it. At last, I found it only works...

How To Make a Score Event Script for On-click game using purely HTML, css and Javascript

javascript,html,events,onclick
I need help on my game, in this chase I need help for On-click event. I have a image that for each time I click on it I get 1 score point. I need help to create this quite basic event or someone who be kind enough to write a...

Get the position of a button clicked in ListView

java,android,listview,button,onclick
I have a fragment where when an item of the list is clicked, you can determine which position using onListItemClick. Now I have a button on each list item (a delete button) and I want to know which position was clicked when it is pressed. How can I do this?...

having audio play on click

javascript,html,audio,onclick
I am trying to get some buttons to work with sound to no success. For the page I am using I have it set up as such: // javascript file for gun tutorial// window.onload=function() { var extraAmmo = 210; var maxAmmo = 30; var currentAmmo = maxAmmo; var extraAmmoHud =...

VBA - on click - generate a prompt to confirm which workbook / spreadsheet to look at

excel,vba,onclick,copy,prompt
I am fairly certain I know how to select data from a different workbook / sheet but I'm a little clueless as to how I would go about generating a VBA question box that would prompt the user on click to input the relevant workbook / sheet. For example: Workbook...

Android: Setting ID's for Array of Image Buttons

android,for-loop,onclick,onclicklistener,imagebutton
I am making an android application that allows users to click either a plus or minus image button to change the number displayed in a text view. There are 18 of the text views and a plus and minus image button for each text view. The activity crashes when i...

How to call a function in a function onclick

javascript,html,function,onclick
At first I want to apologize for my bad English. I am making tic tac toe in JavaScript, but the reloading of the game isn't working for me. I have made a button like this: <button onclick="restart()"> Opnieuw! </button> My script looks like this: function Canvas(){ /* other functions */...

onClick on img works but cannot dynamically attach the same even in javascript, what is wrong?

javascript,javascript-events,onclick
The following code creates two objects, one statically defined in html, with an event that works, and one defined in javascript that does not. Obviously this can be done in javascript, so what is wrong? <!DOCTYPE html> <html> <head> <script> function build() { var img = document.createElement("img"); img.src = "cat.jpg";...

How to do multiple clicks with .trigger()?

jquery,triggers,onclick,click
Is there a simplier way to do this in jQuery? $('button').click(function() { // do something }).trigger('click').trigger('click').trigger('click'); ...

Function not working on onclick event?

javascript,jquery,onclick
I've a common function : function initialize(){ selectedAttachment(); } which is first called on ajax success and then after onclick event Ajax call : $.ajax({ url: HTTP_LANYARDS + 'orders/lyPrices', dataType: 'json', type: 'get', beforeSend: function(){ $('.overlay').show(); }, complete: function(){ $('.overlay').hide(); }, success: function(json){ ajaxData = json; initialize(); if(typeof(editOrder)==='function'){ editOrder(); }//calling...

Getting Mobile Menu to stay open when clicking submenu - Slicknav

jquery,mobile,menu,onclick,slicknav
I'm using Slicknav: http://slicknav.com/ I almost have all the behavior right but not quite. I want the menu to close whenever someone clicks outside of it, which I got, except that now that I enforced that, the menu closes when I try to open a submenu. I need to get...

Do something when clicking on class [duplicate]

javascript,class,onclick,click
This question already has an answer here: How do you assign an event handler to multiple elements in JavaScript? 1 answer I am trying to run a function when user clicks on a class. Here is a fiddle with a similar setup. Except that I am not using buttons...

Javascript replace function in same field

javascript,html,replace,onclick
My code <!DOCTYPE html> <html> <body> <input type="text" id="text" value=""><br> <button onclick="myFunction()">Submit</button> <script> function myFunction() { var str = document.getElementById("text"); var res = str.replace("1", "2"); document.getElementById("text") = res; } </script> in input field i am taking some input from user on (click) submit i want to replace all 1 with...

How to create both onClick and mouseover to a link jQuery

jquery,function,onclick,hover,mouseover
I have this script to change main image on click to a link with .feature_thumb class. I want to make it so that it's both click and hover. $(".feature_thumb").click(function(){ var main_href = $(this).attr('href'); change_image(main_href ); }); Can someone help me with this? I tried this but it didn't work... $(".feature_thumb").on('click...

Change text on click without losing original CSS

jquery,html,css,text,onclick
I am new to Jquery and Javascript and been having some trouble changing the "like" button to "liked" when it has been clicked. I have managed to change the color of the button and contents on click, but when I would add an if/else statement to have it change the...

onClick to a new activity but the app stopped

java,php,android,listview,onclick
There is a listview showing all products. It is supposed that a new activity page which allows me to edit product(either save or delete)will be shown after I click the item on the listview. However, when I click the item, the app stopped with error message: Unfortunately, XXX(my app name)...

Jquery plugin - onclick event for multiple elements

javascript,jquery,jquery-plugins,onclick
I'm creating a jQuery plugin that listens to click events on multiple elements that have the same ID name. // On click listener base.$el.click(function (event) { event.preventDefault(); alert("clicked!"); }); The click event works only on the first of multiple HTML elements. How I'm initializing the plugin: $('#test-button').scrollTo(); How can I...

Change image to another image after 6 clicks in HTML with Jquery

jquery,html,onclick
I have been struggling with this matter for a while. I am quite new to HTML and Jquery. The idea is to switch images after multiple clicks. All I need is some advice and tips! The solution was the IF statement! var change = 1; $('.checkOpdracht1').click(function(){ if (change++ % 6...

Trouble Integrating JavaScript into HTML with button onClick event

javascript,html,onclick
I have written and tested all my code in NetBeans and it works fine in the IDE. When I try to integrate it into my webpage, my button onClick event does not execute. I have this in my header: <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script src="http://www.afanalytics.com/files/theme/2015.05.23_boilerUpgrade.js"></script> I have uploaded the js file...

LibGDX - How to combine Clicked() method from two click listeners in LibGDX similar to Android?

java,android,onclick,libgdx,onclicklistener
I want to combine the following two buttons (button1 & button2) into one clicked() method which is similar to Android using v.getId(). In LibGDX: button1.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float x, float y){ button1.setText("It was the first button."); } }); button2.addListener(new ClickListener(){ @Override public void clicked(InputEvent event, float...

firing onsen's setMainPage in onclick using variable from ng-repeat

javascript,angularjs,onclick,angularjs-ng-repeat,onsen-ui
i want to make my Onsen UI splitView app to set the main page with a certain page based on a variable it got from the clicked item in a list. the list is generated by ng-repeat. i have searched about ng-repeat and ng-click, but none give what i am...

Repeat Function inside PHP

php,mysql,loops,onclick
I'm struggling with this problem and can't figure it out. Here's what I've done: Form: <form method="POST" action="search.php" name="form" id="form"> <input type="text" name="search" id="search" placeholder="Introduza a sua Localização"> <input type="submit" name="Submit" value="Pesquisar"> </form> php looping: <?php if (mysql_num_rows($tournaments) !=0){ do { ?> <div id="rightDetails"> <i class="fa fa-gamepad"></i> <a href="games.php?id_game=<?php echo...

Using .innerHTML from an onClick function

javascript,onclick,innerhtml
I am having trouble using .innerHTML within a javascript function called by clicking a button. For a brief flickering second I can see that the function is called, and the text changed, but then the text reverts. <html> <head> </head> <body> <form> <input type="submit" value="Change the Text" onClick="change()"> </form> <div...

Show drop down menu onmousedown without loosing onclick functionality

javascript,drop-down-menu,onclick,focus,onmousedown
I try to get a drop down menu to work as most drop down menus seem to work, i.e. as soon as the mouse button is pressed on the trigger the drop menu shows up. Seems rather easy with some css and javascript but it turns out to be a...

Calling string from array using loop after onclick funcion [javascript]

javascript,arrays,loops,onclick
I would like to display one of arrays after clicking matching array: for example image 1 after clicking will display array 1 image 2 after click will display array 2: var DetailArray = new Array( "number 1", "number 2", "number 3" ); function ShowNumber(number) { document.getElementById("number").value= ; } img src...

Can I set custom onClick on my timeline using fabric sdk?

twitter,android-listview,onclick,android-adapter,fabric-twitter
I am creating a Twitter client using Fabric but I can not create a custom onClick. I created this custom adapter and tried to create a OnClickListener but not working. Always open in browser tweet. public class TweetAdapter extends TweetTimelineListAdapter { public ArrayList<Long> tweetIds=new ArrayList<Long>(); public TweetAdapter(Context context, Timeline<Tweet> timeline)...

Button OnClick does not work in ASP .NET

c#,asp.net,onclick,master-pages
I'm working with Bootstrap. I created a master page and the general purpose is to store the input from user in the contact form (name, email, message,...), captcha used also: <!-- Omitted --> <asp:TextBox ID="txtName" runat="server" CssClass="form-control" placeholder="Name*" required data-validation-required-message="Please enter your name." /> <!-- CAPTCHA --> <asp:TextBox ID="txtCaptcha" runat="server"...

How to let onclick disappear after clicking on something else

javascript,html,css,onclick
I am just working on my new webspace and I have a small problem. I know have to input tags with an onclick function <script> function mark( el ) { el.style.borderBottom= "3px solid white"; } </script> When I click on the first input the border appears as I want but...

Select element by next/previous button when click

javascript,jquery,html,onclick,click
I'm trying to select tab elements by next/previous buttons instead of number buttons, means go to next tab by click. Default Buttons Fiddle: http://jsfiddle.net/LLdy3gd2/ HTML: Default Number Buttons <p> <button class="select-tab" value="0">1</button> <button class="select-tab" value="1">2</button> <button class="select-tab" value="2">3</button> </p> JS: Default $(document).ready(function () { $('#horizontalTab').responsiveTabs({ rotate: false, startCollapsed: 'accordion', collapsible:...

link to div inside div within same HTML [SOLVED]

php,html,twitter-bootstrap,onclick,anchor
I am currently using Bootstrap Timeline (example here). Since this will be a long timeline I want at the top of it to have some symbols (each with a date and a unique ID), which will represent certain event. When clicking a certain symbol I want to be redirect to...

Javascript onclick display multiple SVGs

javascript,svg,path,onclick
I am trying to display multiple SVG paths after clicking on a SVG polygon. I was able to get and individual path to appear onclick by using document.getElementById(id).style.display = "block"; getElementById() on works for one path though. How can I get the onlclick to work for multiple paths? I tried...