narjis Posted August 21, 2012 Share Posted August 21, 2012 Hi, I'm unable to focus on an input field inside a div. here is my code. <script> $("select").change(function () { var str = ""; $("select option:selected").each(function () { str += $(this).val() ; }); $.post("option.php",{data:str}, function(data){ $("div").addClass('datepicker').html(data); //alert(data); } ); }); // .trigger('change'); // Datepicker $('.datepicker').load(function(){ alert('hello'); }); </script> Quote Link to comment Share on other sites More sharing options...
ultraloveninja Posted August 27, 2012 Share Posted August 27, 2012 I think that you need to return the focus to the div or item that you want such as : div.focus() or something of that sort Quote Link to comment Share on other sites More sharing options...
codefossa Posted August 28, 2012 Share Posted August 28, 2012 If its the first input element you would do $("div").find("input:eq(0)").focus(); if $("div") points to the correct location. Multiple divs are most likely on the page, so set an id to the element so you can use $("#divID") Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.