我正在使用在厚箱中打开的tinymce按钮为wordpress主题添加短代码。
我尝试将一个脚本排入队列,在厚盒页面中添加一些动画和验证,但它不起作用。该脚本排队正确,如果我使用警报功能进行测试,它运行良好,但当我尝试选择厚箱元素中的任何元素时,它都无效。
这是用于创建打开thickbox的tinymce按钮的代码
ed.addButton('twospermsShortcodes_button', {
title : 'Insert Shortcodes',
image : url+'/images/star.png',
onclick : function() {
tb_show("Insert Shortcode", url + "/popup.php?width=" + 650);
}
});
这是厚箱页面的代码:
<div id="button-dialog">
<form action="" method="post">
<div>
<label for="button-url">Button URL</label>
<input type="text" name="button-url" value="" id="button-url" />
</div>
<div>
<label for="button-text">Button Text</label>
<input type="text" name="button-text" value="" id="button-text" />
</div>
<div>
<label for="button-size">Size</label>
<select name="button-size" id="button-size" size="1">
<option value="small">Small</option>
<option value="medium" selected="selected">Medium</option>
<option value="large">Large</option>
</select>
</div>
<div>
<label for="button-style">Style</label>
<select name="button-style" id="button-style" size="1">
<option value="less_round">Less Round</option>
<option value="round" selected="selected">Round</option>
<option value="square">Square</option>
</select>
</div>
<div>
<label for="button-color">Color</label>
<select name="button-color" id="button-color" size="1">
<option value="gray" selected="selected">Gray</option>
<option value="blue"=>Blue</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="black">Black</option>
</select>
</div>
<div>
<label for="button-align">Alignment</label>
<select name="button-align" id="button-align" size="1">
<option value="gray" selected="selected">None</option>
<option value="left"=>Left</option>
<option value="right">Right</option>
</select>
</div>
<div>
<a href="#" id="insert">Insert</a>
</div>
</form>
</div>
这是用于排队脚本的代码,我希望通过以下方式添加一些动画:
wp_register_script("admin_script2"
,get_template_directory_uri() . "/functions/js/shortcodes_handling.js", array('jquery'));
wp_enqueue_script("admin_script2");
这是javascript代码:
jQuery(window).load(function() {
alert("test");
jQuery("div#button-dialog a#insert").click(function(e) {
e.preventDefault();
alert('fs');
});
});