Jump to content

insertAtCursor not working


Buttero

Recommended Posts

Hey, does anyone know why this insertAtCursor isnt working for me?:

 

<a href="javascript:insertAtCursor($('textarea'),'<img src=%22%22>');">Image</a></code>

Thats all the javascript I have, and Im assuming that i dont need to add anything else in the page to make it work. I want it to insert an image tag when you click it, like what we have here on the left.

I dont know what to put in the ' ($('textarea'') ' part either. 

Here is the whole form im using this in:

<code><form method="post" action="idontthinkso.php">
<fieldset>
<legend>Submit new frontpage news article</legend>

<label for="user">Username:</label><br>
<select name="user">
  <option>Namel</option>

</select>

<input name="date" type="hidden" value="Wed Jan 31, 2007 "><br>

<label for="title">Title:</label><br>
<input name="title" type="text">
<br>

<a href="javascript:insertAtCursor($('textarea'),'<img src=%22%22>');">Image</a>

<label for="description">Description:</label><br>
<textarea name="description" cols="50" rows="20" wrap="virtual"></textarea>
<br>

<p><input name="submit" type="submit" value="Submit">
</p>

</fieldset>
</form>

 

I am not using prototype, and I dont have a function defined, this is my first time with javascript and I dont know what to do now!  ???

Link to comment
https://forums.phpfreaks.com/topic/36514-insertatcursor-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.