javascript - Remove html element from a page loaded as ajax response into div -


i trying remove link(i want make button please in too) id=regbutton index.jsp page loaded response on clicking login button on regdata.jsp page

regdata.jsp

<script>  $(document).ready(function(){      $("button").click(function(){          $("#maindiv").load("index.jsp");          $('#regbutton').remove();      });  });  </script>  </head>  <body>  <div id="maindiv" class="units-row">  <h2>thanks registering!</h2>  <button id="reglogin">login now</button>  </div>

index.jsp

<body>         <center>           <s:actionerror />           <h1 id="login_title"></h1>           <form action="checklogin.action" method="post">              <p>                 <input type="text" id="username" name="username"                     placeholder="" >              </p>              <p>                 <input type="password" name="password"                     placeholder="" id="password">              </p>              <label> <input type="checkbox" name="remember_me" id="remember"><label for="remember" id="rememberlbl"></label></label>              </p>              <input type="submit" class="btn-log" method="execute"                 key="label_login"> &nbsp;&nbsp;           </form>           <a href="registerlogin.action" id="regbutton">register</a>                 </center>     </body>

the jquery's load function takes second or third parameter - callback function execute when loading done. if want button disappear when load completes should move code handler:

$(document).ready(function(){     $("button").click(function(){         $("#maindiv").load("index.jsp", function() {           $('#regbutton').remove();         });     }); }); 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -