Lara
Lara

Reputation: 3021

How to get Value from HTML tag in Jquery

I have a HTML tag like this available in jquery variable

var v = "<input type='checkbox' name='select' id='' value=1>"

As per my requirement i need to get the Value from this HTML Tag i.e 1 and store it into another Jquery Variable.

Upvotes: 2

Views: 41

Answers (1)

Christos
Christos

Reputation: 53958

You could try something as simple as

var val = $(v).val();

var v = "<input type='checkbox' name='select' id='' value=1>";
document.write($(v).val());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Upvotes: 3

Related Questions