Skip to:
Content
Pages
Categories
Search
Top
Bottom

try a lot to remove square brackets from activity, anyone help


  • Keno
    Participant

    @tangpage

    [ edited – please use ‘code’ button when sharing code]

    i have my post form code as below:

    ///////////////////////////////

    <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10" placeholder="Share the moment?" onfocus="this.rows=80;" onkeypress="return LimitThis()" onkeyup="textAreaAdjust(this);return CountThis(ActivityLimit)" onmouseover="return CountThis(ActivityLimit)" wrap=physical maxLength="280"><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_attr( $_GET['r'] ); ?> <?php endif; ?></textarea>
    <p><span id="ActivityLimit">280</span></strong></p>
    
    <script>
    function textAreaAdjust(o) {
        o.style.height = "1px";
        o.style.height = (25+o.scrollHeight)+"px";
    }
    
    function LimitThis() {
    	var myObject=event.srcElement;
    	if (myObject.value.length==myObject.maxLength*1) return false;
    }
    
    function CountThis(visCnt) { 
    	var myObject=event.srcElement;
    	if (myObject.value.length>myObject.maxLength*1) myObject.value=myObject.value.substring(0,myObject.maxLength*1);
    	if (visCnt) visCnt.innerText=myObject.maxLength-myObject.value.length;
    	
    }
    </script>
    

    ///////////////////////////////

    now i want to strip [] square brackets from activities, and i added the code below….

    <script>
    document.getElementById('whats-new').onkeyup = function(event) {
    
        this.value = this.value.replace(/[^a-zA-Z\,.!:;"'~$*()_+-={}<>|%&#@\s\d]/, '');
    
    }
    </script>

    but after added this, the countdown and adjust area broken…. anyone could help?

Viewing 2 replies - 1 through 2 (of 2 total)

  • youmin
    Participant

    @youmin

    Try editing buddypress/activity/home.php , after copying these files from buddypress plugin to your theme. If you have already copied files from plugin then search the files from activity folder and edit it from there.


    Keno
    Participant

    @tangpage

    no i meant these codes has conflicting… and i don’t know how to make all these function work on the post form textarea…. ; (

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘try a lot to remove square brackets from activity, anyone help’ is closed to new replies.
Skip to toolbar