Best Jquery ,javascript, HTML5 CSS3 tutorial with jquery examples, php script , demos for beginners, web designers and web developers.

Jquery

Jquery Training

Jquery training blog

How to get the selected option text of select box in jQuery

<html> <head> <title>How to get the selected option text of select box in jQuery</title> <script src=”https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js”></script> </head> <body> <div>How to get the selected option text of select box in jQuery</div> <select id=”gettext”> <option value=”1″>One</option> <option value=”2″>Two</option> <option value=”3″>Three</option> </select> <div> You have selected : <span id=”selectedtext” style=”color:red”></span> </div> <script> $(document).ready(function(){ $(‘#gettext’).click(function(){ $(‘#selectedtext’).text($(‘#gettext option:selected’).text()); }) }); Continue Reading


<html>
<head>
<title>How to get the selected option text of select box in jQuery</title>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
</head>
<body>
<div>How to get the selected option text of select box in jQuery</div>

<select id="gettext">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<div>
You have selected : <span id="selectedtext" style="color:red"></span>
</div>
<script>
$(document).ready(function(){
$('#gettext').click(function(){
$('#selectedtext').text($('#gettext option:selected').text());
})

});

</script>

</body>
</html>
<html>
<head>
<script type="text/javascript">
function displayResult()
{
document.getElementById("myTable").insertRow(-1).innerHTML = '<td>1</td><td>2</td>';
}
</script>
</head>
<body>
<div>Add a table row in javascript</div>
<table id="myTable" border="1">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br />
<button type="button" onclick="displayResult()">Insert new row</button>
</body>
</html>
<html>
<head>
<title>How to get a drop-down list selected text in jQuery</title>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
</head>
<body>
<div>How to know which radio button is selected via jQuery?</div>

<input type="radio" name="radioName" class="className" value="1" /> 1 <br />
<input type="radio" name="radioName" class="className" value="2" /> 2 <br />
<input type="radio" name="radioName" class="className" value="3" /> 3 <br />

<div>
You have selected : <span id="selectedradio" style="color:red"></span>
</div>
<script>
$(document).ready(function(){
$('.className').click(function(){
$('#selectedradio').text($('input[type="radio"][class="className"]:checked').val());

})

});

</script>

</body>
</html>
Please follow and like us:






About the author

Joydeb Choudhury holds a Master's degree in Computer Application from I.G.N.O.U. After working as a web developer in various companies he has started bloging in 2016.

Recent Posts of blog

Downalod Free Php Scripts