jqtransform表单事件问题 [英] jqtransform form events problem

查看:97
本文介绍了jqtransform表单事件问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名具有CSS体验的网页设计师,但我不是一个JS开发人员。



我用jqtransform来设计一个搜索表单,
问题是它从选择器和搜索按钮中删除所有事件。



这里是jqtransform之前的代码

 < input id =go-searchtype =buttonname =btn_searchvalue =searchonclick =searchLocations()/> 

在应用脚本后,该按钮不会执行任何操作
我打开页面来源,这里是如何:

 < button class =jqTransformButtontype =buttonname =btn_search id =go-search>< span>< span> search< / span>< / span>< / button> 

请帮助我!

解决方案

我认为最好在新帖中提出新的问题...

  $(function() $(form.jqtransform)。jqTransform(); $(#city)。click(populateDestrict);}); 

当通过JavaScript为事件分配函数时,只需分配函数引用。将括号放在函数识别器后面将执行该函数。

  function myFunction(x)
{
alert (X);
return 1;
}

//正确,onload事件将触发函数
window.onload = myFunction;
// alert[object Event]

//错误
window.onload = myFunction(hello);
//这会为onload属性分配1*
// * - IE可以执行此操作,但没有标准的兼容浏览器


I'm a web designer with css experience, but I'm not a JS developer.

I used jqtransform to style a search form , the problem is it removes all events from selectors and the search button .

here is the code before jqtransform

<input id="go-search" type="button" name="btn_search" value="search" onclick="searchLocations()" />

and after applying the script, the button doesn't do any thing I opened the page source and here how it looks like:

<button class=" jqTransformButton" type="button" name="btn_search" id="go-search"><span><span>search</span></span></button>

Please help me !

解决方案

I think it’s best to put new questions in new posts …

$(function() { $("form.jqtransform").jqTransform(); $("#city").click(populateDestrict); });

when assigning functions to an event by JavaScript, you only assign the function reference. putting parentheses behind a function identifyer will execute the function.

function myFunction(x)
{
    alert(x);
    return 1;
}

// correct, the onload event will trigger the function
window.onload = myFunction;
// alerts "[object Event]"

// wrong
window.onload = myFunction("hello");
// this assigns "1" to the onload property*
// * - IE may execute this, but no standard compliant browser

这篇关于jqtransform表单事件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆