Js this function calls without having to recapture the id name or tag name

  • 2020-03-30 02:10:23
  • OfStack

This is the node that you currently want to execute js to capture, so you can capture the id, name, or tag name in js without using document.getelement. It's usually obj.
 
<input type="button" id="tianjia" value=" bao   save " class="btn1" onClick="nullCheck(this)"/> 
<script> 
function nullCheck(obj) 
{ 
......//Here write the code for the functionality you need
} 
</script> 

<input type="checkbox" name='agentType' id="exclusiveAgenter" value="exclusive" onchange="clickAgenter(this)"> 

function clickAgenter(obj){ 
if($(obj).attr("checked")=="checked"){ 
$("[name='agentType']").removeAttr("checked");//To cancel all
$(obj).attr("checked","checked") 
} 
} 

Related articles: