get the id of a div in jquery
alert($(this).attr('id')) var rid = $(this).attr('id'); //for dynamically created elements<script>
$(document).ready(function(){
$("#myBtn").click(function(){
var elmId = $("#test").attr("id");
alert(elmId);
});
});
</script>
<body>
<div id="testDiv">Data of the Div</div>
<br>
<button type="button" id="myBtn">Show Div ID</button>
</body>$("#YourElementId").val();
Also in JavaScript:
- javascript method
- replace array element javascript stack overflow
- computed property name javascript
- javascript replace all spaces with dashes
- angular loop through key values in map
- settimeout inside loop
- how to reload page on button click in javascript
- prevent adding the item twice in an array javascript
- javascript console.log
- react native dynamic view size
- not getting webhook post request json data in my laravel controller
- json parse returns object
- js create object from array
- React Hook Form
- cordova capacitor document viewer fail
- react get screen width
- funcion dentro de objeto
- react create array
- checking if var is not defined js
- sjson.Set query
- reduce method in javascript array of bjects
- how to generate a random number between 1 and 6 in javascript
- how to make an object in p5 go right to left with keycCicked p5
- store data in browser javascript