To check all checkboxes in jQuery, we make use of prop() function with attribute value selector. This function is only available in jQuery 1.6 or higher. For jQuery 1.5 or lower, please make use of attr() function. Example is given below for jQuery 1.6 or higher. <!DOCTYPE html> <html> <head> <title>jQuery Tutorial </title> <script src="http://code.jquery.com/jquery-latest.js"></script>
To uncheck a checkbox in jQuery, we make use of prop() function. This function is only available in jQuery 1.6 or higher. For jQuery 1.5 or lower, please make use of attr() function. Example is given below for jQuery 1.6 or higher. <!DOCTYPE html> <html> <head> <title>jQuery Tutorial </title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> //Function to
To check a checkbox in jQuery, we make use of prop() function. This function is only available in jQuery 1.6 or higher. For jQuery 1.5 or lower, please make use of attr() function. Example is given below for jQuery 1.6 or higher. <!DOCTYPE html> <html> <head> <title>jQuery Tutorial </title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> //Function to
To change image source attribute value using jQuery, we make use of attr() function. Example is given below. <!DOCTYPE html> <html> <head> <title>jQuery Tutorial </title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> //Function to Change Image. function ChangeImage(){ $('#myImage').attr('src', 'http://www.fwait.com/wp-content/uploads/2015/11/jquery-115x115.jpg'); } </script> </head> <body> <input type="button" value="Change Image" onclick="ChangeImage()"/> <br /> <br /> <img id="myImage" src="http://www.fwait.com/wp-content/uploads/2015/11/JavaScript-115x115.png" > </body>
To add style using jQuery, we make use of css() function. Example is given below. <!DOCTYPE html> <html> <head> <title>jQuery Tutorial </title> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> //Function to apply style. function myStyle(){ $('#divHello').css('background-color','red'); } </script> </head> <body> <input type="button" value="Apply CSS" onclick="myStyle()"/> <br /> <br /> <div id="divHello">Hello World! </div> </body> </html>