Hi.

I have 2 functions, and when you click on a div, the first one is
called.
it modifies an area, and the gives the div another click handler.

it works perfect in FF or Chrome, but in IE, it automaticly "clicks
the div again", and runs the other function.

my script:

function editProposal(proposalID) {
   $(".propTitle-" + proposalID).replaceWith("<input id=txtTitle-" +
proposalID + " type=text size=40 value=" + $(".propTitle-" +
proposalID).text() + " />");
      if ($(".propText-" + proposalID).html() != null) {
         $(".propText-" + proposalID).replaceWith("<textarea
id=txtarea-" + proposalID + " cols=65>" + $(".propText-" +
proposalID).html().replace(/\<br\>/g, "\n") + "</textarea>");
      }
      else {
         $(".propText-" + proposalID).replaceWith("<textarea
id=txtarea-" + proposalID + " cols=65>" + $(".propText-" +
proposalID).text() + "</textarea>");
      }
   $(".edit-proposal-" + proposalID).text("update").bind("click",
function() {
      updateProposal(proposalID);
      return false;
   });
}


function updateProposal(proposalID) {
   if ($("#txtTitle-" + proposalID).val() != '' && $("#txtarea-" +
proposalID).val() != '') {
      $.post('BrainstormV2.aspx', { action: 'ajax', method: 'update',
ProposalID: proposalID, Title: $("#txtTitle-" + proposalID).val(),
Content: $("#txtarea-" +     proposalID).val().replace(/\n/g,
"<br>") }, function(msg) {
      $("#txtTitle-" + proposalID).replaceWith("<span
class='largetxtsize bold propTitle-" + proposalID + "'>" + $
("#txtTitle-" + proposalID).val() + </span>");
      $("#txtarea-" + proposalID).replaceWith("<span class='propText-"
+ proposalID + "'>" + $("#txtarea-" + proposalID).val().replace(/\n/g,
"<br>") + "</span>");
      $(".edit-proposal-" + proposalID).text("edit").unbind();
      });
   }
   else {
      alert("you can not leave the title or proposal empty.");
      $(".edit-proposal-" + proposalID).unbind();
   }
}

Reply via email to