JavaScript String Search Methods
JavaScript String Search Methods JavaScript provides several methods that search strings: indexOf, lastIndexOf, and search. These basic methods tell you whether a match has been found. The first three return …
By Nikunj Joshi
JavaScript String Search Methods JavaScript provides several methods that search strings: indexOf, lastIndexOf, and search. These basic methods tell you whether a match has been found. The first three return …
Get Elements by Tag Name The getElementsByTagName() method returns a collection of an elements’s child elements with the specified tag name, as a NodeList object. Return a live HTMLCollection. Syntax …
How to close current tab in a browser window? You will need Javascript to do this. close(); Note: the current tab is implied. This is equivalent: window.close(); or you can …
jQuery and PHP get user geo location address It will works in localhost without https but in live server it will works with https only. You can download code files …
One thing I’ve seen experienced JavaScript developers struggle with is making cross-domain requests. Libraries like jQuery will handle all of the complexities of this and gracefully degrade to other technologies …
Below script is warn user if user goes to another page without saving form data. <form id=”myForm”> <p> <label for=”field1″>field1</label> <input type=”text” name=”field1″ id=”field1″> </p> <p> <label for=”field2″>field2</label> <input type=”text” …
index.html file <html> <head> <style> span { color: green; } </style> <script> function showHint(str) { if (str.length == 0) { document.getElementById(“txtHint”).innerHTML = “”; return; }else { var xmlhttp = new …
<script type=”text/javascript”> $(document).ready(function() { $(‘input[type=radio][name=user_role]’).change(function() { var selValue = $(this).val(); alert(selValue); }); $(‘input[type=radio][name=status]’).on(‘change’, function() { switch($(this).val()) { case ‘allot’: alert(“Alloted”); break; case ‘transfer’: alert(“Transfer”); break; } }); }); </script>