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

  • Home
  • SEARCH
  • 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 8029443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:26:18+00:00 2026-06-05T00:26:18+00:00

I am trying to overwrite a JavaScript on change event in the below code

  • 0

I am trying to overwrite a JavaScript on change event in the below code with jQuery however I believe that the inline JavaScript is taking priority over the jQuery functionality declared. Essentially I am trying to have an AJAX version of my site which includes an additional JavaScript file. I need this functionality to still work without the additional AJAX version, but I am not sure as to whether I should include it in the main JavaScript file or leave it inline like it is right now. Any suggestions and information regarding them would be greatly appreciated! Thanks!

<form action="/cityhall/villages/" method="post" name="submit_village">
    <select name="village" onchange="document.submit_village.submit();">
        <option value=""></option>
    </select>
</form>

I am trying to use the jQuery Form Plugin to submit the posts to the PHP to handle the requests as follows:

var bank_load_options = { 
    target:        '#content',
    beforeSubmit:  showRequest,
    success:       showResponse
};
$('form.get_pages').livequery(function(){
    $(this).ajaxForm(bank_load_options);
    return false;
});

I modified the code as following:

<form action="/cityhall/villages/" method="post" id="submit_village" name="submit_village">
    <select name="village" class="get_pages" rel="submit_village">
        <option value=""></option>
    </select>
</form>

<script>
# main JavaScript
$('.get_pages').live('change',function(e){
    var submit_page = $(this).attr('rel');
    $("#"+submit_page).submit();
});

# ajax JavaScript
var bank_load_options = { 
    target:        '#content',
    beforeSubmit:  showRequest,
    success:       showResponse
};
$('.get_pages').live('change',function(){
    var submit_page = $(this).attr('rel');
    $("#"+submit_page).ajaxForm(get_pages_load_options);
    return false;
});
</script>

However now it only runs every other option when I change it.

  • 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-05T00:26:20+00:00Added an answer on June 5, 2026 at 12:26 am

    It is good practice to have all your Javascript in one place (not one file specifically, but not half inline, half in a file), as such I would remove all inline Javascript.

    This would also your help with priority issue as you can manage it all from the same location.

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

Sidebar

Related Questions

I'm trying to load in my WebView some HTML code that contains JavaScript. Now
Hi I am trying to load a webview that uses javascript and html5. However,
I am very new to JavaScript. Kindly note that I am trying below issue
I am trying to use this library that allows for inline table editing, and
i'm investigating how to change the generated javscript code in *.nocache.js. I'm trying to
I am trying to invoke camera from HTML5 and JavaScript. My code is as
I am trying to access a page that has certain javascript that causes errors
I have been trying to do something like below. JavaScript $.ajax({ url: 'login.php', type:
I'm struggling with trying to modify some Javascript code. I know what I want
I am using Rails 3.1.3 with active admin gem. I am trying overwrite the

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.