Ricky Barnes has Published 121 Articles

How to get the POST values from serializeArray in PHP?

Ricky Barnes

Ricky Barnes

Updated on 20-Dec-2019 06:20:34

3K+ Views

To get the POST values from serializeArray in PHP, use the serializeArray() method. The serializeArray( ) method serializes all forms and form elements like the .serialize() method but returns a JSON data structure for you to work with.Let’s say we have the PHP content in serialize.php file:ExampleThe following is an ... Read More

How to change first and last elements of a list using jQuery?

Ricky Barnes

Ricky Barnes

Updated on 18-Dec-2019 07:35:28

574 Views

To change the first and last elements of a list use the eq() method.ExampleYou can try to run the following code to change first and last elements of a list using jQuery:Live Demo    $(document).ready(function(){    $("#list li:eq(2)").after($("#list li:eq(0)"));  });     This ... Read More

What is an Event Object in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 11-Dec-2019 06:32:29

247 Views

The callback function takes a single parameter; when the handler is called the JavaScript event object will be passed through it.The event object is often unnecessary and the parameter is omitted, as sufficient context is usually available when the handler is bound to know exactly what needs to be done ... Read More

What are event attributes in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 11-Dec-2019 06:21:12

365 Views

jQuery events have attributes such as for keyup and keydown events, if the Ctrl key was pressed, timestamp when the event created, etc.The following are some of the event properties/attributes available:S.NoProperty & Description1altKeySet to true if the Alt key was pressed when the event was triggered, false if not. The ... Read More

How can I bind all events on a DOM element using jQuery?

Ricky Barnes

Ricky Barnes

Updated on 11-Dec-2019 06:04:49

524 Views

The bind( type, [data], fn ) method binds a handler to one or more events (like click) for each matched element. It can also bind custom events.Possible event values − blur, focus, load, resize, scroll, unload, click etc.Here is the description of all the parameters used by this method −type − ... Read More

How to check the element type of an event target with jQuery?

Ricky Barnes

Ricky Barnes

Updated on 11-Dec-2019 06:02:58

1K+ Views

To check the element type pf an event target, using the is() method.ExampleYou can try to run the following code to check the element type:Live Demo $(document).ready(function(){    $( "ul" ).click(function( event ) {       var target = $( event.target );       ... Read More

How to fetch nth div from an HTML page using jQuery?

Ricky Barnes

Ricky Barnes

Updated on 09-Dec-2019 07:59:33

192 Views

To fetch the nth div from an HTML page, use the jQuery eq() method. It is used to access the index of an element in jQuery. The eq() method refers the position of the element.ExampleYou can try to run the following code to learn how to fetch nth div from ... Read More

How to access index of an element in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 09-Dec-2019 07:58:09

724 Views

To access the index of an element in jQuery, use the eq() method. The eq() method refers the position of the element.ExampleYou can try to run the following code to learn how to access index of an element in jQuery, Live Demo $(document).ready(function(){    $('ul li').eq(2).css({'background-color':'#E6B16A'});}); ... Read More

How to access element with nth index in jQuery?

Ricky Barnes

Ricky Barnes

Updated on 09-Dec-2019 07:50:04

932 Views

To access element with nth index from an HTML page, use the jQuery eq() method. It is used to access the index of an element in jQuery. The eq() method refers the position of the element.ExampleYou can try to run the following code to access element with nth index in ... Read More

How to remove all CSS classes using jQuery?

Ricky Barnes

Ricky Barnes

Updated on 06-Dec-2019 10:33:52

4K+ Views

To remove all classes, use the removeClass() method with no parameters. This will remove all of the item's classes.ExampleYou can try to run the following code to remove all CSS classes using jQuery:Live Demo           jQuery Selector                 ... Read More

Advertisements