Thursday, 27 September 2018

JQUERY : DOM manipulation / Change id content using jquery

Same as javascript getElementById("");

FOR TEXT

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

</head>
<body>

<div id="demo">
   <p>The initial text</p>
</div>


<script>
$(document).ready(function(){
  $('#demo').text('The replaced text.');
});
</script>
</body>
</html>

FOR HTML




<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

</head>
<body>

<div id="demo">
   <p>The initial text</p>
</div>


<script>
$(document).ready(function(){
  $('#demo').html('<b>The replaced text.</b>');
});
</script>
</body>
</html>

Auto select after redirect to the contact page SELECT JAVASCRIPT

 https://domain.my/contact/?startup_package=UltimateImpact         <select name="startup_package" class="form-select"...