jQuery checked selector
>> YOUR LINK HERE: ___ http://youtube.com/watch?v=rMrZlm2hyLg
Link for all dot net and sql server video tutorial playlists • https://www.youtube.com/user/kudvenka... • Link for slides, code samples and text version of the video • http://csharp-video-tutorials.blogspo... • Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. • / @aarvikitchen5572 • In this video we will discuss the jQuery :checked selector. • The :checked selector selects all checked checkboxes or radio buttons. Let us understand this with an example. • Selects all checked radio button elements • $('input[type= radio ]:checked') • Example : When you click the submit button without selecting any radio button, No radio button checked message should be displayed. • When you click the submit button after a radio button is checked, then a message stating Male is checked or Female is checked should be displayed. • Replace lt; with LESSTHAN symbol and gt; with GREATERTHAN symbol. • lt;html gt; • lt;head gt; • lt;title gt; lt;/title gt; • lt;script src= jquery-1.11.2.js gt; lt;/script gt; • lt;script type= text/javascript gt; • $(document).ready(function () { • $('#btnSubmit').click(function () { • var result = $('input[type= radio ]:checked'); • if (result.length gt; 0) { • $('#divResult').html(result.val() + is checked ); • } • else { • $('#divResult').html( No radio button checked ); • } • }); • }); • lt;/script gt; • lt;/head gt; • lt;body style= font-family:Arial gt; • Gender : • lt;input type= radio name= gender value= Male gt;Male • lt;input type= radio name= gender value= Female gt;Female • lt;br / gt; lt;br / gt; • lt;input id= btnSubmit type= submit value= submit / gt; • lt;br / gt; lt;br / gt; • lt;div id= divResult gt; • lt;/div gt; • lt;/body gt; • lt;/html gt; • Selects all checked checkbox elements • $('input[type= checkbox ]:checked') • Example : When you click the submit button without checking any checkbox, No checkbox checked message should be displayed. • When you click the submit button after checking a checkbox, then a message stating the number of checkboxes checked and their values should be displayed. • lt;html gt; • lt;head gt; • lt;title gt; lt;/title gt; • lt;script src= jquery-1.11.2.js gt; lt;/script gt; • lt;script type= text/javascript gt; • $(document).ready(function () { • $('#btnSubmit').click(function () { • var result = $('input[type= checkbox ]:checked'); • if (result.length gt; 0) { • var resultString = result.length + checkboxe(s) checked lt;br/ gt; ; • result.each(function () { • resultString += $(this).val() + lt;br/ gt; ; • }); • $('#divResult').html(resultString); • } • else { • $('#divResult').html( No checkbox checked ); • } • }); • }); • lt;/script gt; • lt;/head gt; • lt;body style= font-family:Arial gt; • Skills : • lt;input type= checkbox name= skills value= JavaScript / gt;JavaScript • lt;input type= checkbox name= skills value= jQuery / gt;jQuery • lt;input type= checkbox name= skills value= C# / gt;C# • lt;input type= checkbox name= skills value= VB / gt;VB • lt;br / gt; lt;br / gt; • lt;input id= btnSubmit type= submit value= submit / gt; • lt;br / gt; lt;br / gt; • lt;div id= divResult gt; • lt;/div gt; • lt;/body gt; • lt;/html gt;
#############################
