jQuery Select element by class name

jQuery Select element by class name

You may want to select the group of html elements by class name instead of it’s ID. To do this, you need to prefix “.” against html element ID.


  1. # is used to get element by ID.
  2. . is used to get elements by class name.

Here we will get the value of input control by class name.

var inputValue = $(".inputTextClass").val();

JQuery Script

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script type="text/javascript" language="javascript">

$(document).ready( function (){ 

    $("#Button1").click( function(){
    var inputValue = $(".inputTextClass").val();


jQuery get element by class name example.

           <input id="Text1" class="inputTextClass" type="text" />
           <input id="Button1" type="button" value="button" />


JQuery Get Element By ID or class name or tag namejQuery Select element by class nameBasics of jqueryJquery Gridview Dropdownlist Selected Change Enable Disable ControlsHow to get Jquery selected optionGridview select emailJQuery Get .next() ElementJQuery add/remove Class DynamicallyJquery Dropdown Selected Valuec# arraylistGet Selected Value From Dropdownlist [JQuery]


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.