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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:07:51+00:00 2026-05-29T04:07:51+00:00

Here’s a confusing question. I need to replace an <input> with a different <input>

  • 0

Here’s a confusing question. I need to replace an <input> with a different <input> but I need to preserve the onclick attribute. Here’s an example:

<input type="image" class="previous_page_img graybutton mediumbutton" src="btn_prevpage.png" onclick="Add_Search_Param('page', 1); Refine();" alt="">

Since I cannot change the <input> type to a button, I want to replace it with a button, however, I need to preserve the “onclick” attribute. So first, I’d have to break up the element. Replace it with a button and append the original onclick attribute to the new button.

So in the end, I’d have this onclick="Add_Search_Param('page', 1); Refine();" added to the new button. Since the onclick changes, a simple .attr or .prop function would not be sufficient. It must clone the onclick attribute. Can anyone help me? Thanks.

Here’s jsFiddle that does not preserve the onclick attribute but does everything else: http://jsfiddle.net/rAMcw/

  • 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-29T04:07:52+00:00Added an answer on May 29, 2026 at 4:07 am

    Just create a new button right after the input, set the input to display: none; (or jQuery('#input').hide()) and have the button onclick trigger the input’s onclick (jQuery('#button').click(function(){ jQuery('#input').trigger('click'); });

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

Sidebar

Related Questions

Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here an example of my checkbox list http://jsfiddle.net/YnM2f/ Let's say I check on G
Here a simple question : What do you think of code which use try
Here is my question. I am having this simple menu. <div id=menu> <ul> <li>
Here is binding: <Image Width=16 Height=16 Source={Binding SwitchForImage, Converter={StaticResource stringToImage}} HorizontalAlignment=Left> </Image> and here
Here is an example: I have a file 1.js, which has some functions. I
here is the scenario 1: user starts to type some word, autocomplete engine shows
Here is an example: I write html code inside of textarea, then I swap
Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here's a basic regex technique that I've never managed to remember. Let's say I'm

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.