Dear experts
I have following codes

<html>
<head>
<script type="text/javascript" src=jquery.js"></script>
<scritp type="text/javascript">
$(document).ready(function(){
$('button[name="button1"]'.click(function(){
$("p").hide();
});
});
</script>
</head>
<body>
<form>
<p>hello</p>
<input type=button name=button1 value=hide>
</form>
</body>
</html>

Why it does not work?

Recommended Answers

All 2 Replies

Line 6 have typo, it should be:-

$('input[name="button1"]').click(function(){

I'd say to try this:

$(document).ready(function(){
    $('input[name=button1]'.click(function(){
        $("p").hide();
    });
});
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.