Click a button/link when page load,find selected and unselected options in Jquery
Click a button when page load
$(document).ready(function () {
$("#link").click(function () {
alert("link clicked");
});
$("#btnSearch").click(function () {
alert("button clicked");
});
$("#btnSearch").trigger('click'); // OR
$("#btnSearch").click();
});
<input type="button" id="btnSearch" value="Search"/>
Click a hyperlink
$('#link').click();
<a href="#" id="link" >Go</a>
Find selected and unselected options
$(document).ready(function () {
$("#sel").find('option:selected').css('background', "red");
$("#sel").find('option:not(:selected)').css('background', "blue");
});
<select id="sel" >
<option value="USA">USA</option>
<option value="SriLanka" selected="selected">SriLanka</option>
<option value="India">India</option>
<option value="Japan">Japan</option>
</select>
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeletePython Training in electronic city
DataScience with Python Training in electronic city
AWS Training in electronic city
Big Data Hadoop Training in electronic city
Devops Training in electronic city
blockchain Training in electronic city
Hibernate Training in electronic city