<script>
$(document).ready(function () {
$("#pid1").click(function () {
$(this).hide(SpeedEnteredByUser);
});
});
</script>
<body>
<p id = "pid1">This is paragraph</p>
</body>
I want to call jquery hide function when paragraph is clicked. But I want to pass the speed(i.e. slow/fast) which is entered by the user. How it can be achieved ?
Here SpeedEnteredByUser is the value entered by the user(using some form) and I want to pass this value to hide function.
Use
.val()jQuery method to get the value of a text input (which should hold your speed value!)parseInt()is used to make sure the value of the input is indeed a number. The function accepts 2 arguments, the value itself, and a radix value to validate against (10 means decimal numbers, 2 means binary, 16 means hexa etc).It’s also possible to do with
<select>s and other types of inputs.