Alex Onsman has Published 203 Articles

How to get the height of a div element using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 08:27:32

2K+ Views

To get the height of a div element, use the height() method in jQuery.ExampleYou can try to run the following code to get the height of a div element using jQuery:Live Demo $(document).ready(function(){     $("button").click(function(){         alert("Height of div element: " + ... Read More

How to get the width of a div element using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 08:26:30

2K+ Views

To get the width of a div element, use the width() method in jQuery.ExampleYou can try to run the following code to get the width of a div element using jQuery:Live Demo $(document).ready(function(){     $("button").click(function(){         alert("Width of div element: " + ... Read More

How can I get the selected value of a drop-down list with jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 08:18:58

7K+ Views

With jQuery, it’s easy to get selected text from a drop-down list. This is done using the select id. To change the selected value of a drop-down list, use the val() method.ExampleYou can try to run the following code to learn how to change the selected value of a drop-down ... Read More

How to replace innerHTML of a div using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 08:14:28

2K+ Views

To replace innerHTML of a div in jQuery, use the html() or text() method.ExampleYou can try to run the following code to learn how to replace innerHTML of a div:Live Demo $(document).ready(function(){     $("#button1").click(function(){          $('#demo').html('Demo text');    }); }); This is Amit! Replace

How to replace the content of an element using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 08:12:34

444 Views

To replace the content of an element using jQuery, use the text() method.ExampleYou can try to run the following code to replace content inside a div:Live Demo $(document).ready(function(){   $("#button1").click(function(){     $('#demo p').text('The replaced text.');  }); });        The initial text Replace Text

How to get HTML content of an element using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 08:10:00

16K+ Views

To get HTML content of an element using jQuery, use the html() method. The html() method gets the html contents of the first matched element.ExampleYou can try to run the following code to get HTML content of an element using jQuery:Live Demo $(document).ready(function(){   $("#button1").click(function(){   ... Read More

How to redirect to another webpage using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 08:05:24

3K+ Views

To redirect to another webpage in jQuery, use attr().ExampleYou can try to run the following code to redirect to another webpage:Live Demo                          $(document).ready(function() {           $(location).attr('href','https://qries.com');        });                    

How to animate scrollLeft using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 07:43:36

2K+ Views

To animate scrollLeft using jQuery, use the animate() method with scrollLeft.ExampleYou can try to run the following code to learn how to animate scrollLeft using jQuery:Live Demo $(document).ready(function(){     $('#scrollme').click(function() {     $('html, body').animate({         scrollLeft: $('#demo').css('left')     }, 500, ... Read More

How to find horizontal Scroll Position using jQuery?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 07:42:34

1K+ Views

To find horizontal scroll position, use the jQuery scrollLeft() method.ExampleYou can try to run the following code to find horizontal scroll position using jQuery.Live Demo               jQuery scrollLeft() method                           ... Read More

How to position horizontal scroll bar at center of DIV?

Alex Onsman

Alex Onsman

Updated on 17-Dec-2019 07:41:36

3K+ Views

To position horizontal scroll bar at center of div, use the scrollleft. You can try to run the following code to position horizontal scroll bar in div.ExampleThe scroll bar is positioned at center of div:Live Demo               jQuery Scroll         ... Read More

Advertisements