javascript - using a JS blur to bring focus to a div -
sorry i'm getting js functions have search box on our page , when call made (i think using ajax) populates search data div. used use jquery live search.
within search query have number of link have class, class relates jquery modal. older version used work using blur function. trying port functionality on new search.
what used have...
the jquery search:
<form method="post" action="<? echo constructurl($platform_name,"https") ?>/process/feedbackcreateuser" enctype="multipart/form-data" class="form-right"> <input name="q" type="text" placeholder="enter idea or feedback ... " name="title..." style="width:100%; " value="<? echo $captchamessage ?>"> <div id="jquery-live-search" style="display:none;"></div> <script src="<? echo $asset_url ?>/3rdparty/feedback/jquery.livesearch.js"></script> <script> jquery('input[name="q"]').livesearch({url: '<? echo constructurl($platform_name,"https")?>/process/searchfeedbackuser/?c=<? echo $id ?>&q='}); </script> </form>
the js made work:
<script type="text/javascript"> <!-- allows search results have same js functions --> $(document).ready(function() { $("input[name='q']").blur(function() { $("div#jquery-live-search [rel='clickover']").clickover({ html : true} ); $("div#jquery-live-search input, div#jquery-live-search textarea").placeholder(); $("div#jquery-live-search .dialog-iframe-card").dialog2iframe( { height:900, closeonoverlayclick: true, closeonescape: true, removeonclose: true, showclosehandle: true, }); $("div#jquery-live-search .dialog-iframe-report").dialog2iframe( { height:900, closeonoverlayclick: false, closeonescape: true, removeonclose: true, showclosehandle: true, }); }); }); </script>
what have ...
the js search (not jquery anymore)
<script type="text/javascript"> $(document).ready(function() { $('#form form').submit(function(){ $('#content').load('<? echo constructurl($platform_name,"https")?>/process/searchfeedback/?c=<? echo $id ?>', { 'q': $('input[name="query"]').val()}).slidedown('500') return false; }); }); $(function(){ $('form').each(function () { var thisform = $(this); thisform.prepend(thisform.find('button.default').clone().css({ position: 'absolute', left: '-999px', top: '-999px', height: 0, width: 0 })); }); }); </script> <div id="form"> <form class="form"> <div class="input-group" style="margin-bottom:10px"> <input type="text" name="query" placeholder="enter idea or feedback ... " class="feedback-search validate[required] form-control search-main" > <span class="input-group-btn"> <input type="submit" name="submit" value="go!" class="btn btn-search"> </span> </div> </div></form> <form method="post" action="<? echo constructurl($platform_name,"https") ?>/process/feedbackcreate" enctype="multipart/form-data" class="form" class="form-right"> </form> <div id="content"> </div>
i have been trying similar no luck.
<script type="text/javascript"> <!-- allows search results have same js functions --> $(document).ready(function() { $("#form").blur(function() { $("div#content [rel='clickover']").clickover({ html : true} ); $("div#content input, div#jquery-live-search textarea").placeholder(); $("div#content .dialog-iframe-card").dialog2iframe( { height:900, closeonoverlayclick: true, closeonescape: true, removeonclose: true, showclosehandle: true, }); $("div#content .dialog-iframe-report").dialog2iframe( { height:900, closeonoverlayclick: false, closeonescape: true, removeonclose: true, showclosehandle: true, }); }); }); </script>
you html has problems:
it doesn't appear have closed out <form class="form">
tag @ before beginning new one. have nested forms , can't happen, should fix first, since $('form').each(function () {
isn't gonna likely. not entirely sure why prepend cloned button form width=0 , height=0 , no on page. kinda seems awkward doing that. why not use same button begin with? why make clone of it?
also, haven't added semi-colon @ end of line here:
$('#content').load('<? echo constructurl($platform_name,"https")?>/process/searchfeedback/?c=<? echo $id ?>', { 'q': $('input[name="query"]').val()}).slidedown('500')
which give syntax error.
you should turn javascript error reporting on in browser able see of jquery/javascript errors , correct these errors 1 one. after that, might fix itself.
also, sure load jquery, since still using in coding... here's cdn jquery use:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
Comments
Post a Comment