I am trying to find a working solution, but at the moment there is nothing useful. I have the following form:
<form id="searchform" action="/search" onsubmit="putText()"> <div class="section" > <div class="edit"><div ContentEditable = "true" id="text"></div></div> <div class="control" onclick="sbmt()"></div> </div> <input id="s" name="q" class="submit" type="submit" value="Send"> </form>
with the following js:
$(window).load(function(){ $(document).ready(function() { $('.edit').keydown(function(e) { if(e.which == 13) { //debugger; $(this).blur().next().focus(); return false; } }); }) }); function ElementInit() { new SectionalElement({ sectionalNodeClassName: 'section', controlNodeClassName: 'control', background: '#f4fa58' }, 'sectional_element'); return true; } function putText() { document.getElementById('s').value = document.getElementById('text').textContent; return true; } function sbmt() { document.getElementById("searchform").submit(); }
(I also use jquery-1.8.3.js) The query should look like this: "mysite.com/search?q=". All I need to do is use div class = "control" as the submit button instead of just typing (just replace the enter button with a div). When I press the enter button, everything is fine, but when I use DIV class = "control", the selection does not work - the form is submitted, but without the request text. I can not use only input because the submit div is part of a third-party api.
Thanx for any suggestions.
source share