Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Help me creating simple and useful plugin !


  • mahdiar
    Participant

    @mahdiar

    Hi
    I’d like to add a button in the activity post form . When someone click on it it add some cod to the activity post text area !
    I know how to do it with javascript but it doesnt worked ! How can I do that ?

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

  • modemlooper
    Moderator

    @modemlooper

    Code gets stripped from post form on submit so you’d have to filter the form as well. The code for activity submit is in global.js file in the folder _inc

    You can try to add your JavaScript there but like i said code gets stripped on submit.


    mahdiar
    Participant

    @mahdiar

    Thanks ! Sorry ! In fact I don’t get what you mean . I write a code and it works offline . Could you pleas check it ?
    `

    function addtext(val) {
    document.whatsnewform.whatsnew.value += val;
    }

    <img src="s33.gif" onclick=addtext(':)‘) alt=”Smiley face” />

    modemlooper
    Moderator

    @modemlooper

    As for the JavaScript not working; the activity posting mechanism heavily uses jquery to function and is most likely killing your code. That is why is suggest you look through global.js to understand how it’s implemented.


    mahdiar
    Participant

    @mahdiar

    Thanks ! I get it . But I should learn jquery :) I try a new code


    modemlooper
    Moderator

    @modemlooper

    Try this site for a basic jquery lesson http://jqfundamentals.com/


    mahdiar
    Participant

    @mahdiar

    I learn it some how . I write the following code but I have a problem . When I click on the image the text is added but when I type something in the text area it doesn’t work any more !!!
    What’s the problem ?
    `

    $(document).ready(function(){
    $(“#sml”).click(function(){
    $(“#whatsnew”).append(“e”);

    });
    });


    <img id="sml" src="s33.gif" onclick=addtext(':)‘) alt=”Smiley face” />

    `


    modemlooper
    Moderator

    @modemlooper

    Your code doesn’t display correctly here can you place it between backticks `


    mahdiar
    Participant

    @mahdiar

    I corrected it .


    modemlooper
    Moderator

    @modemlooper

    `

    $(document).ready(function(){
    $(“#sml”).click(function(){
    $(“#whatsnew”).val(“:)“);

    });
    });


    Smiley face

    `


    mahdiar
    Participant

    @mahdiar

    Thanks for your reply . I’d like to add text Not to change it !
    For example :
    I write ” Hello world ” Then click on the image and “:)” added to the text . (Hello world :) )
    The code you write change the value to the “:)


    modemlooper
    Moderator

    @modemlooper

    `$(document).ready(function(){
    $(“#sml”).click(function(){
    var text = $(“textarea#whatsnew”).val();
    var newtext = text + ‘ : )’;
    $(“textarea#whatsnew”).val(newtext);
    });
    });`


    mahdiar
    Participant

    @mahdiar

    Thanks A lot !
    Sorry for my late answer ! I didn’t have any time to test it .
    I tested it and it worked .
    Now I should make the plugin . Is there any document that I can use ?


    modemlooper
    Moderator

    @modemlooper

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Help me creating simple and useful plugin !’ is closed to new replies.
Skip to toolbar