Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8478477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:45:24+00:00 2026-06-10T18:45:24+00:00

jQuery(document).ready(function() { jQuery(#bfCaptchaEntry).on(click, function(){ jQuery(#bfCaptchaEntry).css(background-color, #FFFFFF); }); jQuery(#bfCaptchaEntry).on(blur, function(){ jQuery(#bfCaptchaEntry).css(background-color, #CC0000); }); }); This

  • 0
 jQuery(document).ready(function() {
     jQuery("#bfCaptchaEntry").on("click", function(){
         jQuery("#bfCaptchaEntry").css("background-color", "#FFFFFF"); 
     });
     jQuery("#bfCaptchaEntry").on("blur", function(){           
         jQuery("#bfCaptchaEntry").css("background-color", "#CC0000"); 
     });
 });

This is the code, it’s supposed to add the onclick and onblur functions to change the background colors of my input field but it doesn’t work.

jQuery code is being loaded before this script and this script is being loaded in a separate file inside the html after it.

What did I do wrong? Any help is appreciated.

EDIT: After trying everything in the answers, I tried Chase’s suggestion in the comments.
it worked like a charm! So the final code is now an inline script after the jQuery is loaded and it’s like this:

jQuery(document).ready(function() {
jQuery("#bfCaptchaEntry").bind("click", function(){ 
jQuery("#bfCaptchaEntry").css("background-color", "#FFFFFF"); });
jQuery("#bfCaptchaEntry").bind("blur", function(){ 
jQuery("#bfCaptchaEntry").css("background-color", "#CC0000"); });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:45:25+00:00Added an answer on June 10, 2026 at 6:45 pm

    I would suggest using .bind() instead of .on() for versions prior to 1.7.

    "As of jQuery 1.7, the .on() method provides all functionality required for attaching event handlers."

    api.jquery.com/on/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On document ready I run this code: jQuery(document).ready(function(){ jQuery('#button').click(function() { jQuery('#contact_form').load(/Users/mge/Downloads/jquery-ajax-1/readme.txt); return false; });
load.js: jQuery(document).ready(function($) { $('.dialog ul li').click(function(e) { switch($(this).attr('id')) { case 'addProject': $('.addDialog').load('/add/addprojectform'); break; case
This is my jQuery code <script type=text/javascript> jQuery(document).ready(function($){ $(#'.$tag.').dcFlickr({ limit: '.$nFlickr.', style: thumb, q:
This is my jquery code jQuery(document).ready (function() { // post $('.post').bind('mouseenter mouseleave', function() {
I have this: jQuery(document).ready(function(){ jQuery('a.color2030').click( function() { jQuery('tbody').hide(); jQuery('tbody.color2030').show(); }); jQuery('a.color2031').click( function() { jQuery('tbody').hide();
I have this code to prevent people entering '£' into a textbox jQuery(document).ready(function(){ jQuery('#cp_price').keypress(function(e){
This is the code: jQuery(document).ready(function() { $('#MessageAddForm').validate({ rules: { 'data[Message][message]': { ... } },
Just curious... I begin my jquery code with this: jQuery(document).ready(function($) { /*code here*/ })
Hi i am using this code: jQuery(document).ready(function(){ var number = 1; /////////////////////////////////////////////////// /* The
Hello I have this snippet of jQuery code jQuery(document).ready(function($) { $.get(<?echo $site['url'];?>modules/tuitting/tuitting_core/classes/count.php, function (data)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.