$(document).ready(function() {
$('.mark-error').click(function() {
var error_code = $(this).data('code');
var error_defect = $(this).data('defect');
var error_mark = $(this).data('mark');
var error_type = $(this).data('type');
$('#error-input').val(error_code);
$.post("/assets/main/php/errors-new.php", {
code: error_code,
mark: error_mark,
defect: error_defect,
type: error_type
},
onAjaxSuccess
);
function onAjaxSuccess(data) {
$('.error-salvation').html(data);
//alert(error_defect);
$('.error-list').slideUp(100);
$('.error-list').removeClass('ext');
}
});
});
<div class="first-ul">
<ul>
<li><span>1</span></li>
<li><span>2</span></li>
</ul>
</div>
<div class="second-ul">
<ul>
<li><span class="data-container"></span><span>text</span></li>
<li><span class="data-container"></span><span>text</span></li>
</ul>
</div>
<script type="text/javascript">
var data=$(".first-ul ul li span");
for (i=0;i<data.length;i++){
$(".second-ul .data-container").eq(i).text(data.eq(i).text())
}
</script>
<div class="button">Button</div>
<div class="class-main">
<div class="class">1</div>
<div class="class">2</div>
<div class="class">3</div>
</div>
<script type="text/javascript">
document.getElementsByClassName("button")[0].onclick=function(){
console.log(document.getElementsByClassName("class")[1])
}
</script>
public class GroundChecker : MonoBehaviour {
private Character player;
private int newobjlayer;
private void Start()
{
player = GetComponentInParent<Character>();
}
private void OnTriggerEnter2D(Collider2D collision)
{
//if (collision == null) print("abcd");
newobjlayer= collision.gameObject.layer;
if ( collision.gameObject.layer==8)
{
player.onGround = true;
//print(collision);
}
if (collision.gameObject.layer != 8)
{
player.onGround = false;
//print(collision);
}
}
private void OnTriggerStay2D(Collider2D collision)
{
if (collision.gameObject.layer == 8)
{
player.onGround = true;
//print(collision);
}
}
private void OnTriggerExit2D(Collider2D collision)
{
Vector3 speed = player.GetComponent<Rigidbody2D>().velocity;
if (collision.gameObject.layer == 8 && speed.y<0||speed.y>0)
{
player.onGround = false;
}
}
}