- Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

check if key already exists using jquery


 78

Show ResultJQUERY


1

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () {

var obj = {
"key1": "test1",
"key2": "test2",
"key3": "test3"
}

if (obj.hasOwnProperty("key1")) {

$("div").text("your key already exists!");

}

else {

$("div").text("your key does not exist!");

}

});
</script>
</head>
<body>

<div></div>

</body>
</html>


By     Created   
The power of the user (%)
5%



The most helpful solutions

get value of div using jqueryget value of div using jquery

Click to see more ...

  141     8