Tag: onclick

如果单击提交按钮,则阻止执行onblur代码

通过以下代码,我希望仅在onblur事件不是由于提交按钮上的“ONCLICK”引起时,才会在元素id =“eg1”的“ONBLUR”上“DO SOMETHING”。 $(document).ready(function() { $(‘#eg1’).blur(function() { if(!($(“#SubmitBut”).click())) { //do something } }); }); 对于Eg:如果用户更改“eg1”文本字段的值并单击下一个文本字段,则必须运行DO SOMETHING代码,但是如果用户更改“eg1”字段的值,然后单击SUBMIT按钮,然后DO SOMETHING代码不能运行。 这是正确的方法吗? 请指导。

点击图片(闪屏)播放嵌入式Youtube电影

我想知道如何制作如下的东西: 我想要一个显示启动图像的图像,点击该图像它将在同一个占位符中播放YouTube电影。 (要清楚我不想直接显示嵌入式播放器,而是先显示可点击的图像)

jQuery Click Div On Div,除了Child Div

我有以下HTML: Server Name X 我试图这样做,当用户点击server div它会打开一个编辑对话框。 问题只是做: $(“.server”).click(function () { //Show edit dialog }); 不起作用,因为如果他们点击删除的X,它会打开编辑对话框。 如何使整个div server具有除delete-server div之外的click事件。

jQuery点击事件立即触发

我正在开发的Web应用程序中有以下代码: var bgcolor = ”; var row = 0; for(var i = 0; i < result.data.length; i++) { // Set alternating background colors bgcolor = ( i%2 == 0) ? ' style=\'background-color: white;\'': ' style=\'background-color: whitesmoke;\''; $( "div.row" ).append("\ \ “+result.data[i][‘client_name’]+”\ “+result.data[i][‘industry_name’]+”\ Saved: “+result.data[i][‘actual_impact’]+” “+result.data[i][‘impact_type_name’]+” / “+formatCurrency(String(result.data[i][‘actual_savings’]))+”\ “+nl2br( result.data[i][‘problem’] )+”\ \ View details »\ \ […]

如何在新添加的行(DataTables)上添加onclick事件?

我正在使用动态添加行 table.row.add 我希望,对于添加到表中的每一行,还要向该行添加onclick事件,以便链接到URL。 那么,我如何引用刚刚添加的行来添加此事件?

jQuery click不适用于新的无限滚动元素

在我的页面上,我有一个包含项目的列表,您可以单击“查看更多”按钮,其中显示有关此主题的更多信息。 此单击函数位于另一页的jQuery中。 我在这个页面上实现了一个无限滚动条,但是现在按钮“查看更多”对新元素不起作用,只对第一个元素有效。 仅供参考:我没有编写这个应用程序的代码,我的任务只是添加无限滚动。 我在网上搜索过这个问题,我读了几遍这可能是因为新元素没有初始化或者其他东西。 但我从未发现如何解决这个问题。 这是无限卷轴的代码: var reachEnd = false; $(window).scroll(function() { if ($(window).scrollTop() == $(document).height() – $(window).height()) { lastPostFunc(); } }); function lastPostFunc() { var trs = $(‘.sresult-row’); /*get the number of trs*/ var count = trs.length; /*this will work as the offset*/ /*Restricting the request if the end is reached.*/ if (reachedEnd […]

HTML onclick with $(this)

我与调用一般的jQuery点击function有冲突,因此我需要在HTML元素本身上调用onclick事件,同时仍然可以使用$(this) $(‘.item-main-section, .item-status’).click( function () { var slideHeight = $(this).parent().children(‘.item-slide-section’).height(); if ($(this).parent().height() > 50) { $(this).parent().animate({height: ’50px’}, 300); $(this).parent().children(‘item-slide-section’).animate({bottom: ‘0px’}, 300); } else { $(this).parent().animate({height: slideHeight + 50 + ‘px’}, 300); $(this).parent().children(‘item-slide-section’).animate({bottom: slideHeight – 5 + ‘px’}, 300); $(this).parent().siblings(‘.item-wrapper’).animate({height: ’50px’}, 300); $(this).parent().siblings(‘.item-wrapper’).children(‘item-slide-section’).animate({bottom: ‘0px’}, 300); } }); 而不是jquery点击我需要onclick =“thisFunction()”元素,但如果我摆脱第一行我失去了使用$(this)的能力。 这很难解释,但我希望对某人有意义。

切换时更改按钮背景颜色

我有一个按钮,我想在点击时将其背景颜色更改为白色,然后当我再次单击它返回其原始背景颜色时,我该怎么做? 这是我的代码: $(document).ready(function () { $(“button”).click(function () { $(this).css(“background-color”, “#FFF”); }); }); Hello

垂直导航,使用JQuery显示隐藏的子菜单

我正在尝试制作一个与此Flash网站上的菜单类似的菜单: http://elevensix.de/ 当我点击“组合”时,只有子导航链接显示自己。 现在我只设法得到一个典型的垂直“在hover菜单上显示子导航”工作。 所需要的是,一旦它适当的菜单项,它的子菜单显示。 当子菜单项目hover在选中时,此子菜单仍然显示。 选择子菜单项时,显示内容,菜单和子菜单都保持可见(选定的菜单和子菜单项将显示不同的颜色以显示导航路径)。 呼。 这是我的HTML: about testimonials testimonial1 testimonial2 testimonial3 testimonial4 Services services1 services2 services3 services4 Gallery Contact 这是我的css: #nav { width:160px; position: relative; top: 250px; left: 20px; } #nav ul { margin:0px; padding:0px; } #nav ul li { line-height:24px; list-style:none; } #nav a { text-decoration: none; color: #9d9fa2; } #nav […]

如何使用内联HTML onclick和jQuery获取单击的元素?

我正在用这段代码创建一个标签: $(‘#td’ + id).append(‘ ‘ + file + ”); excluirArquivofunction function excluirArquivo(arquivo) { $.ajax({ type: ‘POST’, url: ‘/erp/proposta/index.php/arquivo/remover/’ + arquivo }); alert($(this)); } 但是excluirArquivo函数里面的这个元素正在返回Window对象。 如何获取excluirArquivo中的单击元素(标记)?