Jquery find class and get the value

I am going to share how to find class and get the value. Jquery provide very easy to way find class and get value. You can find any value of html attribute using Jquery like class, id, tag etc. You can use find() method search all descendant elements of the selected element.

Now i am give you some example to better way to understand.


In this example you can get value of input box from calss.

HTML element

<div id="element">
        <input type="text" class="yourClass" value="my value" name="yourtext"/>

Jquery Code

var yourVar = $("#element").find('.yourClass').val();

Leave a Reply

Your email address will not be published. Required fields are marked *