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> Link to comment https://forums.phpfreaks.com/topic/267356-jquery-help/ 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 Link to comment https://forums.phpfreaks.com/topic/267356-jquery-help/#findComment-1373041 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") Link to comment https://forums.phpfreaks.com/topic/267356-jquery-help/#findComment-1373304 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.