I have few tabs with same form inside of them, only difference is location of work in hidden element.
I'm loading my tabs with ajax a href="blah.htm"
I want to bind onClick to element in form, but problem is that since form is the same on all tabs jquery only operates on first instance, i.e. first tab.
Question is ..how can 开发者_StackOverflow社区i use jquery on selected tab instead on first tab?
You're not giving out a lot of details, but If I guess correctly the following will work for you
$('.myform input').click(function() {
//do something here
})
Ie. refer to your form by class instead of IDs or Names.
With this you get the added bonus of having per tab onClick handlers with zero efforts:
$('#tab1 .myform input')
精彩评论