Can't get jQuery's .replaceWith() to work?

ikram

New Member
Basically I am trying to have jQuery replace the button with the form and status div once clicked. I am new to jQuery and hardly an advanced programmer so I am sure the solution will be relatively simple. On the other hand I am at my wits end with this issue and any help would be greatly appreciated. Thank you.EDIT: Solution found. Interestingly enough it also only worked when I put it in a separate .js file and referenced it, not when I had it within tags on the php page. Thanks again to everyone who responded!\[code\]$(document).ready(function() { $("#repbutton").click(function() { $("#repbutton").replaceWith("<form id=\"reputation_form\" method=\"post\"> Give positive reputation to <?=$reply_user['username']?> for their reply? Comment: <input type=\"text\" name=\"comment\" id=\"comment\" /> <input type=\"hidden\" id=\"uid\" value=http://stackoverflow.com/"<?=$reply_user['id']?>\"> <input type=\"hidden\" id=\"rid\" value=http://stackoverflow.com/"<?=$replies_row['id']?>\"> <input type=\"hidden\" id=\"urid\" value=http://stackoverflow.com/"<?=$user_row['id']?>\"> <input type=\"submit\" value=http://stackoverflow.com/"Give Reputation\" /></form><div id=\"status\"> <p></p> </div>"); }); });\[/code\]
 
Back
Top