Hi.. guys here is a simple javascript code for removing prices from the custom options drop down text.
[js]
<script type="text/javascript">
//<![CDATA[
var $j = jQuery.noConflict();
$j(document).ready(function(e) {
$j("select.product-custom-option option:first-child").html("Select");
checkoptions();
$j("select.product-custom-option").change(function(){
checkoptions();
});
});
function checkoptions(){
$j("select.product-custom-option option").each(function(){
var optiontext = jQuery(this).text();
var addsignpos = optiontext.indexOf('+');
var subtractsignpos = optiontext.indexOf('-');
if(addsignpos>0){
var result = optiontext.substring(0,addsignpos-1);
$j(this).html(result);
}
if(subtractsignpos>0){
var result = optiontext.substring(0,subtractsignpos-1);
$j(this).html(result);
}
});
}
//]]>
</script>
[/js]
Hope it helps some one. enjoy :-)
No comments:
Post a Comment