Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell form does not validate

Why in this code after click on button get error: http://jsfiddle.net/FyUgH/

{"error": "Shell form does not validate{'html_initial_name': u'initial-js_lib', 'form': , 'html_name': 'js_lib', 'label': u'Js lib', 'field': , 'help_text': '', 'name': 'js_lib'}"}

<form action="#" method="POST">
    <input type="text" name="name">
    <button id="cli">Submit</button>
</form>


$('#cli').live('click',function(e){
        e.preventDefault();
    alert('oo')
        if($('input[type="text"]').val()=='')alert('input is empty')
    })
});
like image 411
Jennifer Anthony Avatar asked Oct 04 '11 12:10

Jennifer Anthony


1 Answers

Remove additional

})

It should look like

$('#cli').live('click',function(e){
    e.preventDefault();
    alert('oo')
    if($('input[type="text"]').val()=='')alert('input is empty')
});

like image 50
genesis Avatar answered Oct 25 '22 21:10

genesis