Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery if data attribute exists

<div id="dataTable" data-timer="10">

</div>


<script>
if (typeof $("#dataTable").data('timer') !== 'undefined') {
	alert("true");
} else{
	alert("false");
}
</script>
Comment

how to check if data attribute exists in jquery

if ($("#dataTable").data('timer')) {
  ...
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: : Cannot set the body fields of a Request with content-type "application/json". 
Javascript :: javascript get all classes 
Javascript :: sts get-session-token 
Javascript :: localstorage 
Javascript :: nodejs mysql connection pool 
Javascript :: javascript trim 
Javascript :: jquery see if checkbox is checked 
Javascript :: how to go to next line in javascript 
Javascript :: javascript insert item into array 
Javascript :: yarn add react-native-elements 
Javascript :: settext javascript 
Javascript :: js sort numbers descending order 
Javascript :: livewire set model with javascript 
Javascript :: material ui textfield change input color 
Javascript :: how to add text to h2 with jquery 
Javascript :: angular production vs development mode 
Javascript :: swap key value object javascript 
Javascript :: Best Way to reset form elements 
Javascript :: jquery set radio button value 
Javascript :: node js send fcm 
Javascript :: javascript autoscroll 
Javascript :: sh: 1: react-scripts: not found 
Javascript :: js first letter to uppercase 
Javascript :: remove current table row in jquery 
Javascript :: react js create element 
Javascript :: javascript redirect to home page 
Javascript :: how to check if an object is map in javascript 
Javascript :: redirect users to anmother page in javascript 
Javascript :: delta time js 
Javascript :: Select options of Select2 control based on values using Jquery 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =