tags:

views:

47

answers:

4

I have input

<input type="hidden" value="Select Value 11121 DataValue " name="111" id="222"/>

I select value with jQuery

alert( $('#222').val() );

but

how can I choose only "11121" from this input value with jQuery ?

I can create a filter ?

+1  A: 

Would it make more sense to create four inputs that are hidden, each one with one of the values from the one

in your post? I would do that rather than try to parse out certain strings from a single input value. Just give each a unique id and go from there.

If you really want to keep one, you could do the following:

<input type="hidden" value="Value1 Value2 Value3 Value4" id="some_id" name="some_name" />

and pluck out the values with:

var vals = $('#some_id').val().split(/\W+/);

and then access them by position:

var val1 = vals[0]; // "Value1"
var val2 = vals[1]; // "Value2"
...
Cory Larson
i this case I need select only by value , a cant compare bu Id, Id will be change
Alexander Corotchi
I know, a have same value ade8c3ac-55c1-dd11-bc33-001e0b8014eband a cand get All value,
Alexander Corotchi
A: 

you can use regexp link text

red777
+1  A: 

You could use a javascript regex to get the numeric value out of that string:

var regex = new RegExp(/\d{5}/igm);

var myNumericValue = regex.exec($('#222').val());
ToRrEs
A: 

Thanks a lot

Alexander Corotchi