好的这次代码让我发疯了
我花了2个多星期使用e.preventDefault()并返回flase以防止onclick href进入页面顶部,但它们不起作用
我用javascript:void(0)它停止滚动窗口到顶部,但输入字段没有生成.
我确定在我的代码中使用这些解决方案存在问题,如果在我的代码中使用这两种方法有问题请告诉我
我的代码:
我正在尝试使用PHP和jquery构建一个向导
在此向导的第2步中,我想在用户单击时动态生成输入字段
<h2><a href="#" id="addScnt">Add Another Input Box</a></h2>
这是Javascript
$(document).ready(function(){
/*****************************/
$('#table_name_error').hide();
// all content starts hidden
$('.wizardcontent').hide();
$('#wizardcontent').hide();
// initialize the wizard state
load_state(1);
// loads new state based on button clicked
$(':button').click(function(){
//reset the wizardcontent to hidden
//$('#wizardcontent').hide();
//load_state(++current_state);
var current_state = $('#wizard').attr('class');
//we only want the number, converted to an int
current_state = parseInt(current_state.replace(/(step_)/, ""));
//figure out if 'next' or 'previous' was clicked and load appropriate state
if ($(this).attr('id') …Run Code Online (Sandbox Code Playgroud)