<form> <div id="poc1"> <input type="text" name="Last_Name" class="Last_Name"> <input type="text" name="First_Name" class="First_Name"> <input type="text" name="Middle_Initial" class="Middle_Inital"> </div><!-- close poc1 --> </form>
I have some jquery that clones the above div, and reassigns the div id to poc2, which results in:
<form> <div id="poc1"> <input type="text" name="Last_Name" class="Last_Name"> <input type="text" name="First_Name" class="First_Name"> <input type="text" name="Middle_Initial" class="Middle_Inital"> </div><!-- close poc1 --> <div id="poc2"> <input type="text" name="Last_Name" class="Last_Name"> <input type="text" name="First_Name" class="First_Name"> <input type="text" name="Middle_Initial" class="Middle_Inital"> </div><!-- close poc2 --> </form>
I have a jquery keyup function targeting the class of the input fields:
$('.Last_Name').keyup(function(){
//my code here
}
Problem is, when I type in the input fields of poc1, it also affects the input fields of poc2, which makes total sense to me. But, I would like to only target the input fields of poc1. Can i do this by targeting the class using some kind of cascade?
I have tried:
$('#poc1 .Last_Name').keyup(function(){
//my code here
}
$('#poc1 > input.Last_Name').keyup(function(){
//my code here
}
It still hits the input field of BOTH divs.
Thanks for any suggestions!
Cheers!

New Topic/Question
Reply



MultiQuote



|