This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('h1', 'div#posts'); //using jQuery wrapper as context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('<div id="test"><p><a>John</a></p></div>').find('a').attr('href' , 'http://phrappe.com/').end().appendTo('body'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Hello World!</p> // Markup $('p:contains("Hello")'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('li.old').replaceWith('<li>new li</li>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('<div/>', { | |
id: 'feature', | |
class: 'post', | |
css: { | |
border : '1px solid red', | |
padding : '5px' | |
}, | |
html: '<p>This is a featured <strong>super</strong> post</p>', | |
click: function() { | |
alert('You click the featured post!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myDiv= $('div')[1]; // myDiv is a raw DOM object | |
alert(myDiv.innerHTML) // and we can do all the normal things with it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ol start="4"> | |
<li>list item 1</li> | |
<li>list item 2</li> | |
<li>list item 3</li> | |
<li>list item 4</li> | |
<li>list item 5</li> | |
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="apple-touch-icon" href="/images/mycustomiphoneicon.png" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.equalHeights = function() { | |
var maxHeight = 0; | |
$(this).each(function(index){ | |
var height = $(this).height(); | |
if (maxHeight < height) { | |
maxHeight = height | |
} | |
}); | |
$(this).height(maxHeight); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:alert("Phrappe.com rocks!")>A vary basic bookmarklet!</a> |
OlderNewer