Select sibling with General sibling $('E ~ F') in jQuery
Description
The following code shows how to select sibling with General sibling $('E ~ F').
Example
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){<!--from w ww . j a va 2 s.c om-->
$("label ~ input").css("color", "red").val("value")
});
</script>
</head>
<body>
<form>
<label>Name:</label>
<input name="name" />
<fieldset>
<label>Address:</label>
<p>p</p>
<input name="newsletter" />
</fieldset>
</form>
<input name="none" />
</body>
</html>
The code above generates the following result.
...
Select elements with id attribute in jQuery
Select empty table cell in jQuery
Select even numbered child in jQuery
Select event table row with Even element se...
Select first paragraph with first selector ...
Select first paragraph with given class in ...
Select for Odd table row with odd element s...
Select for nested classes with .myClass.myO...
Select input element by
Select input element by name attribute in j...
Select input element that don't have the na...
Select last paragraph in jQuery
Select not checked form input elements in j...
Select numbered child in jQuery
Select odd numbered child in jQuery
Select paragraph at even position and remov...
Select parent with parent selector $("td:pa...
Select sibling for checked form elements $(...
Select tag inside another tag in jQuery
Select tags from nextAll() by tag name in j...
Select text input element in jQuery
Select the child of a div element in jQuery
Select the first LI element from selected e...
Select the first parent in jQuery
Select the first row in a table $("tr:first...
Select the first span element after clickin...
Select the first span element $("span:first...
Select the first table row in jQuery
Select the first two table cells by Less th...
Select the hidden div tags with hidden sele...
Select the input element by name and then s...
Select the last row in table with last sele...
Select the last table row in jQuery
Select the next and change its text in jQue...
Select the next elements who has certain cl...
Select the next sibling and apply style in ...
...
Select elements with id attribute in jQuery
Select empty table cell in jQuery
Select even numbered child in jQuery
Select event table row with Even element se...
Select first paragraph with first selector ...
Select first paragraph with given class in ...
Select for Odd table row with odd element s...
Select for nested classes with .myClass.myO...
Select input element by
name
a...Select input element by name attribute in j...
Select input element that don't have the na...
Select last paragraph in jQuery
Select not checked form input elements in j...
Select numbered child in jQuery
Select odd numbered child in jQuery
Select paragraph at even position and remov...
Select parent with parent selector $("td:pa...
Select sibling for checked form elements $(...
Select sibling with General sibling $('E ~ ...
Select tag first parent in jQuerySelect tag inside another tag in jQuery
Select tags from nextAll() by tag name in j...
Select text input element in jQuery
Select the child of a div element in jQuery
Select the first LI element from selected e...
Select the first parent in jQuery
Select the first row in a table $("tr:first...
Select the first span element after clickin...
Select the first span element $("span:first...
Select the first table row in jQuery
Select the first two table cells by Less th...
Select the hidden div tags with hidden sele...
Select the input element by name and then s...
Select the last row in table with last sele...
Select the last table row in jQuery
Select the next and change its text in jQue...
Select the next elements who has certain cl...
Select the next sibling and apply style in ...
...