无法为DialogModal jquery插件调用操作

时间:2014-10-05 04:10:56

标签: javascript jquery dialog

我购买了一个名为DialogModal的jquery插件。代码中有一部分可以将代码应用于按钮的操作。我已尝试使用jquery进行广泛实现,但不能。

以下是该插件的链接:Plugin Page

以下是插件生成的内容:

function getRangerModal()
{
    var content='<form id="rangerform" method="post" action="/en/ranger"> 
<div> <input type="text" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;" name="first_name" id="first_name" value="" placeholder="Firstname"> </div>
<br> <div> <input type="text" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;" name="last_name" id="last_name" value="" placeholder="Lastname"> </div>
<br> <div> <input type="text" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;background-position: right -33px;" name="emailaddress" id="emailaddress" value="" placeholder="Emailaddress"> </div>
<br> <div> <input type="password" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;background-position: right -77px;" name="password" id="password" value="" placeholder="Password"> </div>
<br/><div><input type="password" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;background-position: right -77px;" name="retype_password" id="retype_password" value="" placeholder="Retype Password"> </form>'; 
var $popup=$(this).DialogModal({ 
theme :"default", 
style :"white", 
overlay :true, 
overlaycolor :"#000", 
overlayopacity :0.5, 
closeoverlay :true, 
closebutton :true, 
title :"Ranger Registration", 
content :content, 
width :400, radius :5, 
draggable :true, 
buttons :[{label:"Get Started", 
class:"button_class", 
action:function(){ $("#rangerform").submit(); }}, ]});
}

如果查看$ popup,会有一个名为action的部分。这是表单提交内容的地方。

我试过了:

$("#rangerform").submit()

它什么都不做。

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

已更新

根据您的最新信息,我确实看到了一个问题,您的代码存在一些问题,额外的&#34;,&#34;

这是一些更正的代码。不确定这是不是你的问题,但试试看看

function getRangerModal()
{var content= '<form id="rangerform" method="post" action="/en/ranger"><div> <input type="text" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;" name="first_name" id="first_name" value="" placeholder="Firstname"> </div><br> <div> <input type="text" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;" name="last_name" id="last_name" value="" placeholder="Lastname"> </div><br> <div> <input type="text" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;background-position: right -33px;" name="emailaddress" id="emailaddress" value="" placeholder="Emailaddress"> </div><br> <div> <input type="password" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;background-position: right -77px;" name="password" id="password" value="" placeholder="Password"> </div><br/><div><input type="password" style="background-image: url(/images/icons.png);background-repeat: no-repeat;background-position: right 11px;-moz-box-sizing: border-box;box-sizing: border-box;display: block;font-size: 15px;height: 40px;padding: 10px;width: 100% !important;background-position: right -77px;" name="retype_password" id="retype_password" value="" placeholder="Retype Password"> </form>'; 
var $popup=$(this).DialogModal({ 
theme :"default", 
style :"white", 
overlay :true, 
overlaycolor :"#000", 
overlayopacity :0.5, 
closeoverlay :true, 
closebutton :true, 
title :"Ranger Registration", 
content :content, 
width :400, radius :5, 
draggable :true, 
buttons :[{label:"Get Started", 
class:"button_class", 
action:function(){ $("#rangerform").submit(); }} ]});
}