Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form>
- ...
- <input type=submit name=name1 ...>
- <input type=submit name=name2 ...>
- </form>
- $('#searchForm').bind( 'submit', function() {
- bx_loading('searchForm', true);
- var sQuery = $('input', '#searchForm').serialize();
- $.post('searchKeywordContent.php', sQuery, function(data) {
- $('#searchArea').html(data);
- bx_loading('searchForm', false);
- }
- );
- return false;
- }
- );
- <form action="">
- <input type="submit" name="opa1">
- <input type="submit" name="opa2">
- </form>
- <script type="text/javascript">
- $('form').on('click', 'input[type="submit"]', function(e) {
- e.preventDefault();
- submitForm();
- // console.log($(this).attr('name'));
- });
- $('form').on('submit', submitForm);
- </script>
- function Название функции([Объект event]) {
- // ...
- }
- $("р, div").click(function(е) {
- $("#divl")
- .append("Элемент " + e.srcElement.tagName + "<br>");
- });
- $('form').on('submit',function(e) {
- var $btn = $(document.activeElement,this);
- if ($btn.is('button, input[type="submit"], input[type="image"]') && $btn.is('[name]'))
- {console.log($btn);}
- return false;
- });
- <form id="form" action="">
- <input type="text" placeholder="Enter your name"/>
- <input class="submit-1" type="submit" value="Button 1"/>
- <input class="submit-2" type="submit" value="Button 2"/>
- </form>
- $('#form :submit').on('click', function (e) {
- if($(e.target).is('.submit-1')) {
- console.log('click submit 1');
- } else {
- console.log('click submit 2');
- }
- });
- $('#form').on('submit', function(e){
- //alert(e.relatedTarget.name);//не работает в Chrome и FF
- alert($(document.activeElement,this)[0].name);
- return false;
- });
- $('#youForm').on('submit', function() { $(this).css('color', '#fff'); });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement