HTML :
<br />
<div id="wrapper">
<textarea cols="55" id="text" maxlength="250" name="msg" rows="4"></textarea>
<input id="submit" name="submit" type="button" value="submit" />
</div>
JS :
jQuery("#wrapper").on("click","#submit",function(){
var text = $("#text").val();
var arrs = [];
var word = /\{(.*?)\}/g;
for(tags = word.exec(msg_data); tags; tags = word.exec(msg_data)){
arrs.push(tags[1]);
}
alert(arrs);
});
Tuesday, October 13, 2015
Tuesday, January 8, 2013
custom facebook and twitter share links
This is how to make custom shares of social networking sites.
Put this inside <head></head> tag.
<meta property="og:image" content="SITE_LOGO" /> // for facebook
Put this on your site image/logo
<img src="SITE_IMAGE_PATH" itemprop="image"> // for google plus
Facebook
<a href="javascript:void(0);" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=SITE_URL','','menubar=0,resizable=1,width=500,height=300')">FACEBOOK</a>
Pinterest
<a href="javascript:void(0);" onclick="window.open('http://pinterest.com/pin/create/button/?url=SITE_URL&media=SITE_LOGO&description=','','menubar=0,resizable=1,width=500,height=300')">PINTEREST</a>
Google+
<a href="javascript:void(0);" onclick="window.open('https://plus.google.com/share?url=SITE_URL','','menubar=0,resizable=1,width=500,height=300')">GOOGLE+</a>
Twitter
<a href="javascript:void(0);" onclick="window.open('https://twitter.com/intent/tweet?text=SITE_DESCRIPTION&url=SITE_URL/&via=SITE_NAME','','menubar=0,resizable=1,width=500,height=300')">TWITTER</a>
Put this inside <head></head> tag.
<meta property="og:image" content="SITE_LOGO" /> // for facebook
Put this on your site image/logo
<img src="SITE_IMAGE_PATH" itemprop="image"> // for google plus
<a href="javascript:void(0);" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=SITE_URL','','menubar=0,resizable=1,width=500,height=300')">FACEBOOK</a>
<a href="javascript:void(0);" onclick="window.open('http://pinterest.com/pin/create/button/?url=SITE_URL&media=SITE_LOGO&description=','','menubar=0,resizable=1,width=500,height=300')">PINTEREST</a>
Google+
<a href="javascript:void(0);" onclick="window.open('https://plus.google.com/share?url=SITE_URL','','menubar=0,resizable=1,width=500,height=300')">GOOGLE+</a>
<a href="javascript:void(0);" onclick="window.open('https://twitter.com/intent/tweet?text=SITE_DESCRIPTION&url=SITE_URL/&via=SITE_NAME','','menubar=0,resizable=1,width=500,height=300')">TWITTER</a>
Wednesday, December 12, 2012
input type text place holder
This is how to put a placeholder on input type text using simple javascript.
<input type="text" name="FullName" id="Fullname" value="Name" onblur="if(this.value == ''){this.value = 'Name'}" onfocus="if(this.value == 'Name'){this.value = ''}" onclick="this.value==''">
<input type="text" name="FullName" id="Fullname" value="Name" onblur="if(this.value == ''){this.value = 'Name'}" onfocus="if(this.value == 'Name'){this.value = ''}" onclick="this.value==''">
Monday, December 10, 2012
no domain in a string url
This is how to display a string url without its domain name.
var thisUrl="http://domain.com/directory/subdirectory/file.name"
var noDomainUrl = thisUrl.replace(/https?:\/\/[^\/]+/i, "");
alert(noDomainUrl);
var thisUrl="http://domain.com/directory/subdirectory/file.name"
var noDomainUrl = thisUrl.replace(/https?:\/\/[^\/]+/i, "");
alert(noDomainUrl);
Tuesday, November 27, 2012
jQuery back to top script
This is an example how to make a back to top button using html and jQuery.
html
<h2 class="backToTop">back-to-top</h2>
<h2 class="backToTopFix">back-to-top</h2>
css
.backToTopFix{
position:fixed;
top:5px;
display:none;
}
jQuery
// get the distance from .stop to top
var checkIfTop = jQuery(".stop").offset().top;
// if window top is greater than or equal to checkIfTop condition
if(jQuery(window).scrollTop()>=checkIfTop){
jQuery(".backToTop").hide();
jQuery(".backToTopFix").show();
}
else{
jQuery(".backToTop").show();
jQuery(".backToTopFix").hide();
}
});
html
<h2 class="backToTop">back-to-top</h2>
<h2 class="backToTopFix">back-to-top</h2>
css
.backToTopFix{
position:fixed;
top:5px;
display:none;
}
jQuery
// get the distance from .stop to top
var checkIfTop = jQuery(".stop").offset().top;
checkIfTopjQuery(window).scroll(function() {
// if window top is greater than or equal to checkIfTop condition
if(jQuery(window).scrollTop()>=checkIfTop){
jQuery(".backToTop").hide();
jQuery(".backToTopFix").show();
}
else{
jQuery(".backToTop").show();
jQuery(".backToTopFix").hide();
}
});
Wednesday, November 14, 2012
WP "You should update your .htaccess now"
If other permalink setting is not working except the default, change the .htaccess file permission to editable.
Thursday, September 20, 2012
jQuery numbers only on textbox
For input[type="text"] number only!
jQuery(".button").keydown(function(event) {
if ( event.keyCode == 46 || event.keyCode == 8 ||
event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 ||
(event.keyCode == 65 && event.ctrlKey === true) ||
(event.keyCode >= 35 && event.keyCode <= 39)){
return;// let it happen, don't do anything
}
else {
if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) &&
(event.keyCode < 96 || event.keyCode > 105 )) {
event.preventDefault();
}
}
});
Subscribe to:
Posts (Atom)
