js endsWith()

This is an example for blastcoding.com

by Agustin Gomez

HTML

<p>pease specify a div to be implemented on the theme</p>
<textarea id="mytextarea">
 
</textarea>
<br/>
<button id="btn">add</button>

JavaScript

//this is an example writed by LAgustin for blastcoding.com
var btn = document.querySelector('#btn')
btn.onclick = function(){
 let ta= document.querySelector('#mytextarea');
 endwithdiv(ta.value);
}

function endwithdiv(tastring){
  if(tastring.endsWith("</div>")){
    alert("your code ends with </div>");
  }
  else{
    alert("your code must end with div to continue");
  }
}