getting value first offset name after click?
How can get value 2011
in input:na开发者_开发问答me
with jquery?
<input type="text" name="hi[2011][]">
Example:
<button>Click me</button>
<input type="text" name="hi[2011][]">
$('button').click(function() {
var f_offset = $('input').prop('name');
alert(f_offset);
}
Using match:
$('button').click(function() {
var f_offset = $('input').prop('name');
alert(f_offset.match(/\d+/)[0]);
})
Example
精彩评论