Home
»
All posts
How to use Google Chrome browser as Mobile browser (IPhone, Android etc...)
in
Chrome Browser
,
Mobile Browser
- on
21:26
-
No comments
OPEN CHROME --> PRESS F12 --> GO TO RESOURCES TAB --> Click on settings image from right side down image ---> Go to overrides tab --> Check Enable check box --> check user agent check box --> select iphone 5 from dropdown list --> select device metrics and set up screen resolution(360x750) --> now browser will behave like a iOS Browser.
How to copy pop up message to notepad in Windows
- on
07:03
-
No comments
Click on pop up header and press ctrl+c after that open notepad and ctrl+v... You will see the message message in notepad.
How to do Check box check event dynamically?
in
JQuery
,
JQuery Examples
- on
07:21
-
No comments
Some times we may have some values are attaching to the checkbox ids, like example below. Using $("[Id*='isAccommadation']") code we can get selected checkbox value and we can do the event operations.
This is not limited to check box. This will applicable for all HTML elements.
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function() {
$("[Id*='isAccommadation']").bind("click", function () {
alert(this.value);
});
});
</script>
</head>
<body>
<div id="hai">
<input type='checkbox' name="1" id='isAccommadation_1' value="JQuery" />JQuery<br/>
<input type='checkbox' name="2" id='isAccommadation_2' value="Example" />Example<br/>
<input type='checkbox' name="3" id='isAccommadation_3' value="Code" />Code<br/>
</div>
</body>
</html>
Check box checked and unchecked using JQuery
in
JQuery Basics
,
JQuery Examples
- on
06:57
-
No comments
By using below code, if we check on one check box, all other check boxes will checked, if we un check all other check boxes will unchecked.
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script language="javascript">
$('document').ready(function() {
$('#requestAccommodication').bind("click", doOperations);
});
var doOperations = (function () {
debugger;
if ($('#hai #requestAccommodication').is(':checked')) {
$("#hai input[type=checkbox]").each(function () {
$(this).prop("checked", true);
});
} else {
$("#hai input[type=checkbox]").each(function () {
$(this).prop("checked", false);
});
}
});
</script>
</head>
<body>
<div id="hai">
<input type="checkbox" id="requestAccommodication" /><br />
<input type='checkbox' name="1" id='isAccommadation_1' />JQuery
<input type='checkbox' name="2" id='isAccommadation_2' />Example
<input type='checkbox' name="3" id='isAccommadation_3' />Code
</div>
</body>
</html>
How to remove tag using JQuery but without tag inner content?
in
JQuery
,
JQuery Examples
- on
22:31
-
No comments
Remove tag using JQuery
We can remove HTML tag using jquery by different scenarios.
1. $('a').contents().unwrap();
This will remove the anchor tag but keep the anchor inner HTML.
2. Come to performance view below code is useful.
var b = document.getElementsByTagName('a');
while(b.length) {
var parent = b[ 0 ].parentNode;
while( b[ 0 ].firstChild ) {
parent.insertBefore( b[ 0 ].firstChild, b[ 0 ] );
}
parent.removeChild( b[ 0 ] );
}
3. We can also use replaceWith JQuery function. Please check below example.
$("a").replaceWith(function() { return $(this).contents(); });
If any other ways, please share in the comments section.