php - Unable to store html divs in a javascript variable -


this how appears

i have game requires specific tile placed in specific holder.

<div id="tile_holder1" ondrop="drop(event)" ondragover="allowdrop(event)"></div> <br>  <!--this allows object dragged--><!--need set draggable true enable object dragged --> <div id = "drag1" draggable="true"  ondragstart="drag(event)" width="336" height="69">  <!--this creates object dragged--> <button id = "tile1">place square on ground start build house</button></div> 

so want object named tile1 dragged , dropped in tile_holder1. im using javascript , struggling how correctly go it. want store required html divs within javascript variables , able use if statement make sure tile in correct holder. i'm new javascript , can't find way it.

ive created function processed on play button been pressed. great.

<button onclick="myfunction()" id = "play">play me</button> <h1 id = "demo"></h1> <script>     function myfunction() {         var message;         var test = document.getelementbyid('tile_holder1').innerhtml;         var test2 = document.getelementbyid('tile1').innerhtml;         if (//i want able check test2 matched correctly test , if display message) {             message = "good";             document.getelementbyid("demo").innerhtml = message;         };     } </script> 

or easier use programming language,possibly php?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -