This is the blog for getting Idea regarding PHP, Magento, jQuery and JavaScript for Customization.

Saturday 6 June 2015

jQuery : ID is exist or not !

jQuery
/*Check any ID exist or not*/

<div id='id1'></div>

<script type="text/javascript">

var id_exist = jQuery('#id1').length;

console.log(id_exist);

        /*This will return 0 if ID not exist otherwise will get 1*/

</script>
,

No comments:

Post a Comment