This page creates one button and one paragraph. Both, button and paragraph has id of btn and para respectively.
<!DOCTYPE html>
<html>
<head><title>Multiple Selector Example</title>
</head>
<body>
<input type="button" id="btn" value="click me" />
<p id="para">Hi, i am a clickable paragraph </p>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="multiple_selector.js"></script>
</body>
</html>
Below is a jquery code for multiple selector example. It selects both id, btn and para.
//multiple_selector.js
$('#btn, #para').click(function(){
alert('I am clicked');
});
<!DOCTYPE html>
<html>
<head><title>Multiple Selector Example</title>
</head>
<body>
<input type="button" id="btn" value="click me" />
<p id="para">Hi, i am a clickable paragraph </p>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="multiple_selector.js"></script>
</body>
</html>
Below is a jquery code for multiple selector example. It selects both id, btn and para.
//multiple_selector.js
$('#btn, #para').click(function(){
alert('I am clicked');
});
No comments:
Post a Comment