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 476499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:29:45+00:00 2026-05-13T00:29:45+00:00

I have two attributes I would like to assign to the same event: ddlBuyer.Attributes.Add(onclick,

  • 0

I have two attributes I would like to assign to the same event:


ddlBuyer.Attributes.Add("onclick", "$('#tbxProdAC').val('');");


ddlBuyer.Attributes.Add("onclick", "$('#txtbxHowMany').val('');");

If I comment one out, the other other works fine. But if I just leave both lines in, only one is fired.

Can someone explain to me the logic behind this and further to that, how I should nest this so that when ddlBuyer executes the onclick event, both txtbxHowMany & tbxProdAC return the value of ”>

  • 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-05-13T00:29:45+00:00Added an answer on May 13, 2026 at 12:29 am

    You can only add a single attribute with a given name, so the second one you are adding replaces the first one. It’s the equivalent of having two “onclick” attributes in an HTML tag. Won’t work.

    This doesn’t mean you can’t fire multiple functions in response to a given event, however. You can, for example, do

    ddlBuyer.onclick = function() {
       //first thing to do
       //second thing to do
    };
    

    Another way to do this is to use the jQuery library; jQuery’s “bind” command can bind multiple functions to a single event. This has the advantage that you don’t have to worry that you’re overwriting an event binding added somewhere else (which the above examples will do).

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

Sidebar

Related Questions

I have two textboxes tbxProdAc and txtbxHowMany . I would like to write a
I have two custom attributes defined like so: internal class SchemaAttribute : Attribute {
What I would like to do, is be able to pass two attributes to
I have two divs inline-table(content and sidebar) and I would like to have the
I have two tables containing three columns containing the same types of information(id, attributes,
In my app I have common methods and attributes that I would like available
I have two ways of doing a similar thing and would like to know:
I would like to share Session Attributes betweet two Controllers in Spring MVC, using
I have two custom attributes, one called 'amz_prod_description' and one called 'upc'. According to
I have two sets of elements with (sometimes) corresponding rel and id attributes: <a

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.