Click here to Skip to main content
15,919,613 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionBad Request Call WCF Service Jquery Ajax Pin
Ericsson Alves6-Feb-14 15:32
Ericsson Alves6-Feb-14 15:32 
QuestionSolve datetime country wise to display? Pin
pkarthionline6-Feb-14 0:46
pkarthionline6-Feb-14 0:46 
AnswerRe: Solve datetime country wise to display? Pin
Garth J Lancaster6-Feb-14 0:55
professionalGarth J Lancaster6-Feb-14 0:55 
AnswerRe: Solve datetime country wise to display? Pin
Richard Deeming6-Feb-14 2:08
mveRichard Deeming6-Feb-14 2:08 
QuestionSyntax error on IE10 but working fine on IE 8... Pin
Member 102794055-Feb-14 19:57
Member 102794055-Feb-14 19:57 
AnswerRe: Syntax error on IE10 but working fine on IE 8... Pin
Richard Deeming6-Feb-14 2:05
mveRichard Deeming6-Feb-14 2:05 
QuestionPopulating Input Fields Using Button UIs Pin
ASPnoob3-Feb-14 21:14
ASPnoob3-Feb-14 21:14 
AnswerRe: Populating Input Fields Using Button UIs Pin
Richard Deeming4-Feb-14 3:14
mveRichard Deeming4-Feb-14 3:14 
jQuery's .click method[^] has two forms; one to attach a handler to the click event of the matched elements, and one to trigger the click event. Your code is calling the second version.

Since the method returns the original jQuery wrapper object, which in Javascript terms is not "false-y", the code within the first if block executes.

Try something like this instead:
JavaScript
$(function() {
   
   // Store the last box to receive the input focus:
   var currentBox = null;
   $(document).on("focus", "#box1, #box2, #box3", function(){ currentBox = $(this); });
   
   $(document).on("click", ".btn", function() {
      if (currentBox) {
         var value = $(this).html();
         if ($.isNumeric(value)) {
            currentBox.val(currentBox.val() + value);
         }
      }
   });
   
});




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Populating Input Fields Using Button UIs Pin
ASPnoob9-Feb-14 18:57
ASPnoob9-Feb-14 18:57 
Questionjava script project - algebric expressions Pin
chgovind2-Feb-14 0:22
chgovind2-Feb-14 0:22 
AnswerRe: java script project - algebric expressions Pin
Richard MacCutchan2-Feb-14 1:38
mveRichard MacCutchan2-Feb-14 1:38 
QuestionFailed to load resource: the server responded with a status of 405 (Method Not Allowed) Pin
Vimalsoft(Pty) Ltd30-Jan-14 8:25
professionalVimalsoft(Pty) Ltd30-Jan-14 8:25 
AnswerRe: Failed to load resource: the server responded with a status of 405 (Method Not Allowed) Pin
Kornfeld Eliyahu Peter2-Feb-14 1:30
professionalKornfeld Eliyahu Peter2-Feb-14 1:30 
AnswerRe: Failed to load resource: the server responded with a status of 405 (Method Not Allowed) Pin
swatishri20-Aug-20 15:19
swatishri20-Aug-20 15:19 
GeneralRe: Failed to load resource: the server responded with a status of 405 (Method Not Allowed) Pin
Vimalsoft(Pty) Ltd20-Aug-20 23:53
professionalVimalsoft(Pty) Ltd20-Aug-20 23:53 
QuestionNo 'Access-Control-Allow-Origin' header is present on the requested resource Pin
Vimalsoft(Pty) Ltd30-Jan-14 1:42
professionalVimalsoft(Pty) Ltd30-Jan-14 1:42 
AnswerRe: No 'Access-Control-Allow-Origin' header is present on the requested resource Pin
Kornfeld Eliyahu Peter2-Feb-14 1:29
professionalKornfeld Eliyahu Peter2-Feb-14 1:29 
AnswerRe: No 'Access-Control-Allow-Origin' header is present on the requested resource Pin
Doug Twyman3-Feb-14 18:28
Doug Twyman3-Feb-14 18:28 
GeneralRe: No 'Access-Control-Allow-Origin' header is present on the requested resource Pin
Vimalsoft(Pty) Ltd3-Feb-14 19:00
professionalVimalsoft(Pty) Ltd3-Feb-14 19:00 
AnswerRe: No 'Access-Control-Allow-Origin' header is present on the requested resource Pin
Abhishek_RK2-Mar-14 20:57
Abhishek_RK2-Mar-14 20:57 
QuestionLearning jQuery Pin
DRAYKKO27-Jan-14 7:06
professionalDRAYKKO27-Jan-14 7:06 
AnswerRe: Learning jQuery Pin
Richard Deeming27-Jan-14 7:34
mveRichard Deeming27-Jan-14 7:34 
GeneralRe: Learning jQuery Pin
DRAYKKO27-Jan-14 7:50
professionalDRAYKKO27-Jan-14 7:50 
GeneralRe: Learning jQuery Pin
Richard Deeming27-Jan-14 10:05
mveRichard Deeming27-Jan-14 10:05 
AnswerRe: Learning jQuery Pin
Graham Breach27-Jan-14 9:44
Graham Breach27-Jan-14 9:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.