jquery 避免按键事件的双重执行

6tdlim6h  于 2022-12-18  发布在  jQuery
关注(0)|答案(2)|浏览(98)

我试图创建一个表,其中包含两列和一个条目来修改它们,第一行后的修改符函数开始执行两次,使其无法写入第二列。
这是修改器的功能:

function mdflv(){
    
    $("#mdfTbl").keyup(function(event){
        if (event.keyCode == 13 && getData(this)!=''){
            if ($(this).parent().attr('id').split('.')[1].split('_')[1] == '0'){//This means if the position is 0 the position is in the id the number before the _td
                $("#attrTbl").attr('col', '0');
                father = $(this).parent();//Searching the father.
                $("body").append($(this));
                $(this).hide();
                if (exist(getData("attrTbl"), getData($(this))) == false){
                    //If theres no duplicate...
                    td = document.createElement('TD');//Creating the new TD
                    $(td).attr('id', $("#attrTblBd").children().length+'.td_1');//Adding the ID.
                    $(father).parent().append(td);//Appending the td to the grand father AKA: the body of the table.
                    $(father).append(getData($(this).attr('id')));//Appendding the data.
                    $(td).append(this);//Appending the modifier to the new TD
                    $(this).attr('value', '');//Cleaning
                    $(this).focus();//Focus again.
                    $(this).show();
                }else{
                    father.append(this);
                    $(this).show();
                }
                return false;
            }else{
                var newCont = parseInt($("#tbody1").children().length)+1;
                //getting the td that will store the data.
                var father = $(this).parent();
                //Appending the data to the TD.
                $(father).append(getData(this));
                //This going to be the next td  
                var td = document.createElement('TD');
                $(td).attr('id', (newCont)+'_td.0');
                $(td).append(this);
                var tr = document.createElement('TR');
                $("#attrTblBd").append(tr);
                $(tr).attr('id', (newCont)+'_tr');
                $(tr).append(td);
                $(this).attr('value', '');//Cleaning
                $(this).show();
                $(this).focus();//Focus again.
                return false;
            }
        }
    });
}

这是HTML

<html><head father="*html" id="header">
        <title father="*head" id="ttl">KarinApp(Karina Application Web Maker)</title>
                <link href="http://www.karinapp.com/favicon.ico" id="favIcon" rel="SHORTCUT ICON">
            <link href="http://www.karinapp.com/modules/general/css/karinapp-style/jquery-ui-1.8.4.custom.css" id="jQueryUI" rel="stylesheet" type="text/css">
        <link father="*head" href="http://www.karinapp.com/modules/appgen/css/main.css" id="general_css" rel="stylesheet" type="text/css">
        <script father="*head" id="SCRIPT1" src="http://www.karinapp.com/modules/general/scripts/jQuery.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT2" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.core.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT3" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.widget.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT4" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.mouse.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT5" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.draggable.js" type="text/javascript"><!--empty--></script> 
        <script id="SCRIPT6" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.droppable.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT8" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.position.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT9" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.resizable.js" type="text/javascript">\\n<!--empty--></script>
        <script id="SCRIPT10" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.dialog.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT12" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.button.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT12" src="http://www.karinapp.com/modules/general/scripts/ui/jquery.ui.autocomplete.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT13" src="http://www.karinapp.com/modules/general/scripts/general.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT14" src="http://www.karinapp.com/modules/general/scripts/Catcher.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT15" src="http://www.karinapp.com/modules/general/scripts/loadPage.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT16" language="javascript" src="http://www.karinapp.com/modules/general/scripts/editor/edit_area_full.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT17" src="http://www.karinapp.com/modules/appgen/scripts/main.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT18" src="http://www.karinapp.com/modules/appgen/scripts/config.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT19" src="http://www.karinapp.com/modules/appgen/scripts/style.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT20" src="http://www.karinapp.com/modules/appgen/scripts/scripts.js" type="text/javascript"><!--empty--></script>
        <script father="*head" id="SCRIPT21" src="http://www.karinapp.com/modules/appgen/scripts/properties.js" type="text/javascript"><!--empty--></script>
        <script id="SCRIPT22" type="text/javascript">
            window.onload = function(){
                postLoad();
            }
                        function __init__(){
                                 main();
                        }
        </script>
<script father="*head" id="batuteJS" src="/modules/appgen/scripts/batute.js" type="text/javascript"><!--empty--></script>
        <link type="text/css" rel="stylesheet" father="*head" id="test_css" href="http://dev.karinapp.com/modules/test/css/main.css"><script type="text/javascript" id="jQuery-test" srcpath="/modules/general/scripts/jQuery.js"><!--empty--></script><script type="text/javascript" id="gnrlScrpt" srcpath="/modules/general/scripts/general.js"><!--empty--></script><script type="text/javascript" id="ctchScrpt" srcpath="/modules/general/scripts/Catcher.js"><!--empty--></script><script type="text/javascript" id="pdloadScr" srcpath="/modules/general/scripts/loadPage.js"><!--empty--></script><script type="text/javascript" id="pdLoader">window.onload = function(){postLoad();
__init__();}</script></head>
<body id="general_bod" key="53a62b31a99b6142cbc5682741a272d2de823713" style="cursor: auto; ">
<div father="*html" id="body" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; " pathcls="modules/test/css/main.css:#body"><!--empty--></div>
                                <div class="ground_div" father="*body" id="optionsDiv" style="position: fixed; ">
               <button father="@optionsDiv" id="addwdg_inp" state="open" type="button" value="Agregar componente" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Agregar componente</span></button>
               <button father="@optionsDiv" id="addPg_inp" type="button" value="Guardar Pagina" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Guardar Pagina</span></button>
               <button father="@optionsDiv" id="addPD_inp" type="button" value="Crear PostData" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Crear PostData</span></button>
               <button father="@optionsDiv" id="addBT_inp" type="button" value="Crear Instrucciones" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Crear Instrucciones</span></button>
      </div><div style="outline-width: 0px; outline-style: initial; outline-color: initial; width: 250px; position: absolute; display: block; z-index: 1002; left: 104px; top: 64px; height: 400px; " class="ui-dialog ui-widget ui-widget-content ui-corner-all  ui-draggable ui-resizable" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-WdgCol"><div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" unselectable="on"><span class="ui-dialog-title" id="ui-dialog-title-WdgCol" unselectable="on">Componentes Basicos</span><a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button" unselectable="on"><span class="ui-icon ui-icon-closethick" unselectable="on">close</span></a></div><div class="properties_div ui-dialog-content ui-widget-content" father="*body" id="WdgCol" main="true" style="width: auto; min-height: 0px; height: 354px; ">
                <label father="@WdgCol" for="container" id="cnt_lab">Contenedor:</label><select father="@properties_div" id="container"><option father="container" id="1" value="body">Body</option></select>
                <table father="@WdgCol" id="widgetsCol">
            
               <tbody><tr father="@" id="wDG_bod.0.1.0" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.0.0"><button id="wDG_bod.0.1.0.0.0" tag="a" new="true" style="position: relative; " class="ui-draggable">A</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="area" tag="area" new="true" style="position: relative; " class="ui-draggable">AREA</button></td><td father="WdgBodModel" id="WdgEl"><button id="audio" tag="audio" new="true" style="position: relative; " class="ui-draggable">Audio</button></td></tr><tr father="@" id="wDG_bod.0.1.3" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.3.0"><button id="wDG_bod.0.1.3.0.0" tag="base" new="true" style="position: relative; " class="ui-draggable">BASE</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="0bdo" tag="bdo" new="true" style="position: relative; " class="ui-draggable">BDO</button></td><td father="WdgBodModel" id="WdgEl"><button id="inp" tag="input" typ="button" new="true" style="position: relative; " class="ui-draggable">Input(Button)</button></td></tr><tr father="@" id="wDG_bod.0.1.6" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.6.0"><button id="wDG_bod.0.1.6.0.0" tag="button" new="true" style="position: relative; " class="ui-draggable">Button</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="code" tag="code" new="true" style="position: relative; " class="ui-draggable">Code</button></td><td father="WdgBodModel" id="WdgEl"><button id="col" tag="col" new="true" style="position: relative; " class="ui-draggable">Column</button></td></tr><tr father="@" id="wDG_bod.0.1.9" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.9.0"><button id="wDG_bod.0.1.9.0.0" tag="colgroup" new="true" style="position: relative; " class="ui-draggable">Colgroup</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="dl" tag="dl" new="true" style="position: relative; " class="ui-draggable">DL</button></td><td father="WdgBodModel" id="WdgEl"><button id="div" tag="div" new="true" style="position: relative; " class="ui-draggable">DIV</button></td></tr><tr father="@" id="wDG_bod.0.1.12" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.12.0"><button id="wDG_bod.0.1.12.0.0" tag="form" new="true" style="position: relative; " class="ui-draggable">Form</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="h1" tag="h1" new="true" style="position: relative; " class="ui-draggable">H1</button></td><td father="WdgBodModel" id="WdgEl"><button id="img" tag="img" new="true" style="position: relative; " class="ui-draggable">Image</button></td></tr><tr father="@" id="wDG_bod.0.1.15" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.15.0"><button id="wDG_bod.0.1.15.0.0" tag="input" typ="checkbox" new="true" style="position: relative; " class="ui-draggable">Input(Checkbox)</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="inp" tag="input" typ="file" new="true" style="position: relative; " class="ui-draggable">Input(file)</button></td><td father="WdgBodModel" id="WdgEl"><button id="inp" tag="input" typ="hidden" new="true" style="position: relative; " class="ui-draggable">Input(Hidden)</button></td></tr><tr father="@" id="wDG_bod.0.1.18" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.18.0"><button id="wDG_bod.0.1.18.0.0" tag="input" typ="image" new="true" style="position: relative; " class="ui-draggable">Input(Image)</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="inp" tag="input" typ="radio" new="true" style="position: relative; " class="ui-draggable">Input(Radio)</button></td><td father="WdgBodModel" id="WdgEl"><button id="input" tag="input" typ="text" new="true" style="position: relative; " class="ui-draggable">Input(Text)</button></td></tr><tr father="@" id="wDG_bod.0.1.21" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.21.0"><button id="wDG_bod.0.1.21.0.0" tag="label" new="true" style="position: relative; " class="ui-draggable">Label</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="link" tag="link" new="true" style="position: relative; " class="ui-draggable">Link</button></td><td father="WdgBodModel" id="WdgEl"><button id="map" tag="map" new="true" style="position: relative; " class="ui-draggable">Map</button></td></tr><tr father="@" id="wDG_bod.0.1.24" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.24.0"><button id="wDG_bod.0.1.24.0.0" tag="meta" new="true" style="position: relative; " class="ui-draggable">Meta</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="obj" tag="object" new="true" style="position: relative; " class="ui-draggable">Object</button></td><td father="WdgBodModel" id="WdgEl"><button id="ol" tag="ol" new="true" style="position: relative; " class="ui-draggable">OL</button></td></tr><tr father="@" id="wDG_bod.0.1.27" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.27.0"><button id="wDG_bod.0.1.27.0.0" tag="input" typ="password" new="true" style="position: relative; " class="ui-draggable">Input(Password)</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="p" tag="p" new="true" style="position: relative; " class="ui-draggable">P</button></td><td father="WdgBodModel" id="WdgEl"><button id="pre" tag="pre" new="true" style="position: relative; " class="ui-draggable">PRE</button></td></tr><tr father="@" id="wDG_bod.0.1.30" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.30.0"><button id="wDG_bod.0.1.30.0.0" tag="input" typ="reset" new="true" style="position: relative; " class="ui-draggable">Input(Reset)</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="smp" tag="samp" new="true" style="position: relative; " class="ui-draggable">Samp</button></td><td father="WdgBodModel" id="WdgEl"><button id="srpt" tag="script" new="true" style="position: relative; " class="ui-draggable">Script</button></td></tr><tr father="@" id="wDG_bod.0.1.33" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.33.0"><button id="wDG_bod.0.1.33.0.0" tag="select" new="true" style="position: relative; " class="ui-draggable">Select</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="spn" tag="span" new="true" style="position: relative; " class="ui-draggable">Span</button></td><td father="WdgBodModel" id="WdgEl"><button id="stl" tag="style" new="true" style="position: relative; " class="ui-draggable">Style</button></td></tr><tr father="@" id="wDG_bod.0.1.36" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.36.0"><button id="wDG_bod.0.1.36.0.0" tag="input" typ="submit" new="true" style="position: relative; " class="ui-draggable">Input(submit)</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="tbl" tag="table" new="true" style="position: relative; " class="ui-draggable">Table</button></td><td father="WdgBodModel" id="WdgEl"><button id="tbody" tag="tbody" new="true" style="position: relative; " class="ui-draggable">TBody</button></td></tr><tr father="@" id="wDG_bod.0.1.39" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.39.0"><button id="wDG_bod.0.1.39.0.0" tag="textarea" new="true" style="position: relative; " class="ui-draggable">TextArea</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="tfoot" tag="tfoot" new="true" style="position: relative; " class="ui-draggable">TFoot</button></td><td father="WdgBodModel" id="WdgEl"><button id="thead" tag="thead" new="true" style="position: relative; " class="ui-draggable">THead</button></td></tr><tr father="@" id="wDG_bod.0.1.42" mlength="3" tchild="WdgEl">
                         <td father="WdgBodModel" id="wDG_bod.0.1.42.0"><button id="wDG_bod.0.1.42.0.0" tag="ul" new="true" style="position: relative; " class="ui-draggable">UL</button></td>
                    <td father="WdgBodModel" id="WdgEl"><button id="var" tag="var" new="true" style="position: relative; " class="ui-draggable">Var</button></td><td father="WdgBodModel" id="WdgEl"><button id="video" tag="video" new="true" style="position: relative; " class="ui-draggable">Video</button></td></tr></tbody></table>
               <hr father="@WdgCol" id="hr0">
               <button father="@WdgCol" id="openPal">Abrir Paleta</button>
    </div><div class="ui-resizable-handle ui-resizable-n" unselectable="on"></div><div class="ui-resizable-handle ui-resizable-e" unselectable="on"></div><div class="ui-resizable-handle ui-resizable-s" unselectable="on"></div><div class="ui-resizable-handle ui-resizable-w" unselectable="on"></div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se" style="z-index: 1001; " unselectable="on"></div><div class="ui-resizable-handle ui-resizable-sw" style="z-index: 1002; " unselectable="on"></div><div class="ui-resizable-handle ui-resizable-ne" style="z-index: 1003; " unselectable="on"></div><div class="ui-resizable-handle ui-resizable-nw" style="z-index: 1004; " unselectable="on"></div></div><div father="*body" id="btcreator" style="display: block; ">
            <!--Comment-->
            
            <label father="@btcreator" id="fncNm_lbl"><!--empty-->              Name:
            </label>
            <label father="@btcreator" id="fatherlbl"><!--empty-->Father:
            </label>
            <input father="@btcreator" id="fncnm" type="text">
            <select father="@btcreator" id="fatherbt"><!--Comment--><option father="@fatherbt" id="fatherbt_Opt0" name="fatherbt_Opt0" value="none">No father</option></select>
            
            <button father="@btcreator" id="createBt" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><!--empty-->Create</span></button><select father="@btcreator" id="fncName"><option father="@fncName" id="fncName_Opt0" name="fncName_Opt0" value="default">Select one...</option><option father="@fncName" id="fncName_Opt1" name="fncName_Opt1" value="oper">Operation</option><option father="@fncName" id="fncName_Opt2" name="fncName_Opt2" value="dirls">List of directories</option><option father="@fncName" id="fncName_Opt3" name="fncName_Opt3" value="opnfl">Open File</option><option father="@fncName" id="fncName_Opt4" name="fncName_Opt4" value="delete">Delete File</option><option father="@fncName" id="fncName_Opt5" name="fncName_Opt5" value="compare">Compare</option><option father="@fncName" id="fncName_Opt6" name="fncName_Opt6" value="cp">Copy</option><option father="@fncName" id="fncName_Opt7" name="fncName_Opt7" value="get">Get</option><option father="@fncName" id="fncName_Opt8" name="fncName_Opt8" value="switch">Switch(If-Else)</option><option father="@fncName" id="fncName_Opt9" name="fncName_Opt9" value="upload">Upload</option><option father="@fncName" id="fncName_Opt10" name="fncName_Opt10" value="modify">Modify(Elements)</option><option father="@fncName" id="fncName_Opt11" name="fncName_Opt11" value="create">Create(Elements)</option><option father="@fncName" id="fncName_Opt12" name="fncName_Opt12" value="find">Select(SQL)</option><option father="@fncName" id="fncName_Opt13" name="fncName_Opt13" value="insert">Insert(SQL)</option><option father="@fncName" id="fncName_Opt14" name="fncName_Opt14" value="update">Update(SQL)</option></select><button father="@btcreator" id="addRpl" value="Add Reply"><!--empty-->Add Reply</button><label father="@btcreator" id="fncNameLbl"><!--empty-->Function:</label>
            
        <label father="@btcreator" for="dtype" id="dTypelbl">Data-Type:</label><select father="@btcreator" id="dtype"><!--Comment--><option father="@dtype" id="dtype_Opt0" name="dtype_Opt0" value="data">Data</option><option father="@dtype" id="dtype_Opt1" name="dtype_Opt1" value="int">Integer</option><option father="@dtype" id="dtype_Opt2" name="dtype_Opt2" value="float">Float</option><option father="@dtype" id="dtype_Opt3" name="dtype_Opt3" value="str">String</option><option father="@dtype" id="dtype_Opt4" name="dtype_Opt4" value="list">Array/List</option></select><button father="@btcreator" id="goto">Go to object...</button><button father="@btcreator" id="frmbt">Add from batute</button><button father="@btcreator" id="addfrmsrc">Add from source</button><button father="@btcreator" id="prevsb" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" aria-disabled="false" title=""><span class="ui-button-text"><!--Comment--></span><span class="ui-button-icon-secondary ui-icon ui-icon-arrowthick-1-w"></span></button><button father="@btcreator" id="gtson" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" aria-disabled="false" title=""><span class="ui-button-text"><!--Comment--></span><span class="ui-button-icon-secondary ui-icon ui-icon-arrowthick-1-s"></span></button><button father="@btcreator" id="nxtsb" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" aria-disabled="false" title=""><span class="ui-button-text"><!--Comment--></span><span class="ui-button-icon-secondary ui-icon ui-icon-arrowthick-1-e"></span></button><button father="@btcreator" id="fthsb" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" role="button" aria-disabled="false" title=""><span class="ui-button-text"><!--Comment--></span><span class="ui-button-icon-secondary ui-icon ui-icon-arrowthick-1-n"></span></button><button father="@btcreator" id="svBt" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Save object</span></button><div father="@btcreator" id="btattr"><!--Comment--><table border="1" father="btattr" id="attrTbl" width="100%" col="0"><thead father="@attrTbl" id="attrTblHead"><tr>
<th>Property
</th><th>Value
</th></tr></thead><tbody father="@attrTbl" id="attrTblBd"><tr id="tbody0"><td id="tbody.tr_0">adsfasdfadfasdf</td><td id="1.td_1">adsfasdfasdfasf</td></tr>                                             <tr id="1_tr"><td id="1_td.0">adsfasdfasdfdf</td></tr><tr id="1_tr"><td id="1_td.0"><input id="mdfTbl" style="width: 180px; display: inline-block; " type="text"></td></tr></tbody><colgroup><col father="@attrTbl" id="col0" width="50%"><col father="@attrTbl" id="col1" width="50%"></colgroup></table></div></div><button father="*body" id="showhid" class="ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-button-icon-only" role="button" aria-disabled="false" title="" style="left: 502px; "><span class="ui-button-text"><!--Comment--></span><span class="ui-button-icon-secondary ui-icon ui-icon-arrowthick-1-e"></span></button></body></html>
0wi1tuuw

0wi1tuuw1#

你还没有附上你的相关标记。但我猜这个事件是从它的来源bubbling
您可能需要重新检查处理程序的附加位置,如果需要,可以使用e.stopPropogation()来防止冒泡
还是你的处理程序中的原始return false;

xwbd5t1u

xwbd5t1u2#

我遇到了类似的问题-我使用计数器进行了巡视:

$(document).ready(function () {

    var handledCount = 0;

    $("#imageUrl").keyup(function () {
        if (handledCount == 0)
        {
            //method logic
            handled = true;
        }
        handledCount++;
        if (handledCount == 2)
            handledCount = 0;
        return false;
    });

相关问题