adsense

Wednesday, October 24, 2018

Find checkbox in span using jQuery

jQuery can be used to find and checkbox inside a span as shown below.


<span class="span1" >
        <input id="chkSelect" 
             checked="checked"
             type="checkbox" /></span>

<script type="text/javascript" >
        $(function () {
            $(".span1 input[type='checkbox']").click(function () {
                if ($(this).is(":checked")) {
                    alert("Checked");
                }
                else {
                    alert("UnChecked");
                }
            });
        });
   </script >


Tuesday, October 16, 2018

check connenction from javascript

We can use javascript to check the current connection and determine if we run in local host. Here I have included the checking of custom domain name as well,


if (window.location.hostname === "localhost" || location.hostname === "127.0.0.1" || window.location.hostname.indexOf('.local') >= 0) {
    alert("Running Locally");
}

Cheers,
Samitha