Reputation: 797
Example my temporary input is 1,2,3
<input type="hidden" id="temp" name="temp" value="1,2,3">
var tempvalue = $("#temp").attr("value")
With jQuery it's possible to get the number 3
only for tempvalue
? So 1,2,
will be removed while onclick action.
Upvotes: 0
Views: 58
Reputation: 832
you can get the whole value and use it as an array OR use jQuery.each() to get the number you want
Upvotes: 0
Reputation: 148514
try this:
var tempvalue = $("#temp").attr("value").split(',')[2]
Upvotes: 1
Reputation: 31077
var parts = tempvalue.split(',');
var third_value = parts[parts.length-1];
Upvotes: 2