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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:03:28+00:00 2026-06-14T21:03:28+00:00

function insertQuestion(form) { var x = <img src=’Images/plussigndisabled.jpg’ width=’30’ height=’30’ alt=’Look Up Previous Question’

  • 0
function insertQuestion(form) {   

var x = "<img src='Images/plussigndisabled.jpg' width='30' height='30' alt='Look Up Previous Question' class='plusimage' name='plusbuttonrow'/><span id='plussignmsg'>(Click Plus Sign to look <br/> up Previous Questions)</span>" ;

    if (qnum == <?php echo (int)$_SESSION['textQuestion']; ?>) {

   $('#mainPlusbutton').html(x); // no need to create a jQuery object

}

//append rows into a table code, not needed for this question

}

<form id="QandA" action="<?php echo htmlentities($action); ?>" method="post">

<table id="question">

<tr>
<td colspan="2">
<a onclick="return plusbutton();">
<img src="Images/plussign.jpg" width="30" height="30" alt="Look Up Previous Question" class="plusimage" id="mainPlusbutton" name="plusbuttonrow"/>
</a>
<span id="plussignmsg">(Click Plus Sign to look up Previous Questions)</span>
</td>
</tr>
</table>

<table id="questionBtn" align="center">
<tr>
<th>
<input id="addQuestionBtn" name="addQuestion" type="button" value="Add Question" onClick="insertQuestion(this.form)" />
</th>
</tr>
</table>

</form>

What is suppose to happen with code above is that the user clicks on the “Add Question” button and this will append question numbers into a table. Now what is suppose to happen is that if the if statement is met in the jquery function, then it suppose to replace the plus button image Images/plussign.jpg with Images/plussigndisabled.jpg. But it is not doing this.

So my question is that what is the best way to replace an image button with another image button? Also in the document ready function I need it to go back to displaying the Images/plussign.jpg button.

  • 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-14T21:03:29+00:00Added an answer on June 14, 2026 at 9:03 pm

    Can use replaceWith() method if you want to replace the whole button with new html

    $('#mainPlusbutton').replaceWith(x); 
    

    API Reference: http://api.jquery.com/replaceWith/

    I suspect you really only want to replace the src of the button, and simultaneously disable it which can be done with attr() and prop() methods

    var newImage='Images/plussigndisabled.jpg';
    
    $('#mainPlusbutton').attr('src',newImage).prop('disabled',true); 
    

    Please be aware that ID’s must be unique in a page, so if you are duplicating rows you will need to revise to using class and modifying a traverse to change the appropriate element

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

Sidebar

Related Questions

function insertQuestion(form) { var x = <img src='Images/plussigndisabled.jpg' width='30' height='30' alt='Look Up Previous Question'
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = createCustomURL(WinNetwork.UserName); document.getElementById(psyncLink).src =
function checkuser(user) { var ret = false; $.ajax({ type:'POST', url:'user.php', async:false, data:{'user':user}, success:function (data)
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS= + WinNetwork.UserName;
function ff_chk_username_unique(element, action) { alert(element.value); alert(action); var actiona=http://localhost/myproject/check/check_username.php; var form_data = { username: element.value,
// function scoreHandArray scores your hand function scoreHandArray(hand) { var score = 0; for
function something(frm,i){ //var ch=frm.outof1.value; for(var j=1;j<=i;j++) { //var b=outof + j; alert(frm.outof+j.value); } //alert(outof
function updateOption(selection, option) { jQuery('body,html').animate({ scrollTop: jQuery(#msg).offset().top }, 800); jQuery('.'+selection).each(function() { jQuery(img.+selection).removeClass(optionSelected); }); jQuery.ajax({
function parseAttach(b) { var h=; for(i=0;i<b.length;i++) { var a=b[i]; switch(a['type']) { case image: h+='<li
function deleteRecordDialog() { var returnThis; var numRecordss = recs.length; var html = /*html= html

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.