Arnab Chakraborty has Published 32 Articles

How do I use jQuery effects?

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Jun-2020 08:19:58

210 Views

For hiding and showing the div, you can use hide and show method.For hiding$('#id1').hide();For showing$('#id1').show();Example showhide                 $(document).ready(function () {          $('#btn1').click(function () {             $('#id1').hide();          });     ... Read More

How to disable/enable an input box with jQuery?

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Jun-2020 07:59:30

18K+ Views

We can easily disable input box(textbox, textarea) using disable attribute to “disabled”.$(‘elementname’).attr(‘disabled’, ’disabled’);To enable disabled element we need to remove “disabled” attribute from this element.$(‘elementname’).removeAttr(‘disabled’);Example    ed                      $(document).ready(function () {             $('#btn1').click(function ... Read More

How to check if a div is visible using jQuery?

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Jun-2020 07:58:38

13K+ Views

You can use .is(‘:visible’) selects all elements that are visible.Example divvisible               $(document).ready(function () {          $("button").click(function () {             var dim = $('#div1').is(":visible");             if (dim == false) {                $('#div1').css({ "display": "block", "color": "red" });             }          });       });     Div is visible    Click Here

How to get current URL in jQuery?

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Jun-2020 07:56:43

4K+ Views

For getting the current URL you can use attr() method or window.location.Example url               $(document).ready(function () {          $("button").click(function () {             alert($(location).attr('href'));             alert(window.location);          });       });     Display URL

How can I get the ID of an DOM element using jQuery?

Arnab Chakraborty

Arnab Chakraborty

Updated on 22-Jun-2020 07:55:54

723 Views

In jQuery attr method is use to get the id attribute of the first matching element.$("btn1").attr("id")In your exampleExample iddom                 $(document).ready(function () {          $('#btn1').click(function () {             alert( $('#test').attr('id'));          });       });                   Click Here

How to set the content of a textarea using jQuery?

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jun-2020 17:10:30

3K+ Views

On clicking the tag,the content is dispaying inside the textarea.Example Live Demo    $(document).ready(function () {       $("a").click(function () {          $("#txt1").val("I AM DISPLAYING IN THE TEXTAREA");       });    });     Quires TEXTAREA ::

How to get the content of a textarea using jQuery?

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jun-2020 17:08:12

680 Views

Here I am using one textarea and one button.The first textarea is used for user input then click the button and display the value in the alert box.Example Live Demo                    $(document).ready(function () {             $("button").click(function () {                var dim = $("#txt").val();                alert(dim);             });          });     Click Here

How to count number of rows in a table with jQuery?

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jun-2020 17:04:04

1K+ Views

Example Live Demo table        table,th,td {       border:2px solid black;       margin-left:400px;    }    h2 {       margin-left:400px;    }    button {       margin-left:400px;    }            $(document).ready(function () {       $("button").click(function () {          var rowcount = $('table tr').length;          alert("No. Of Rows ::" +rowcount);       });    }); HTML TABLE NAME AGE DD 35 SB 35 AD 5 AA 5 Click Here

How to get current URL in JavaScript?

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jun-2020 14:20:51

594 Views

The window.location object can be used to get the current URL.window.location.href returns the href(URL) of the current page.I am using these code in my MVC projet.Example                                          var iid=document.getElementById("dd");         alert(window.location.href);       iid.innerHTML = "URL is" + window.location.href;    

Why we should use whole string in Java regular expression

Arnab Chakraborty

Arnab Chakraborty

Updated on 21-Jun-2020 14:14:42

1K+ Views

In Java regex matches() matches the input string against the whole string as it add a ^ and $ at the end of the input string.so it will not match the substring. So for matching substring, you should use find().Exampleimport java.util.regex.*; class PatternMatchingExample {    public static void main(String args[]) ... Read More

Advertisements