www.webdeveloper.com
Results 1 to 3 of 3

Thread: Insert URL into jQuery return <button>

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    6

    Insert URL into jQuery return <button>

    See image for details:

    http://oi45.tinypic.com/jkf221.jpg

    Code:
    base.prototype.pre_edit_button = function() {
          var _this = this;
          return jQuery('<button>', {
            'class': 'fee-hover-edit',
            'html': FrontEndEditor.data.edit_text,
            'click': function(ev) {
              _this.last_mouse_pos = ev.pageY;
              return _this.start_editing();
            }
          });
    Url to be redirected (back-end page edit): wp-admin/edit.php?post_type=page

    My lame try:

    Code:
        }, base.prototype.edit_button = function () {
            var _this = this;
            return jQuery("<?php edit_post_link( __( 'Full Edit',) ?> ", {
            })
    I know nothing of PHP/jQuery/Javascript, it didn't show up anything, but at least script kept running

    Notes:

    edit_post_link is a wordpress function that redirects to the full-editing of the current page. I won't use it, I'll just try to redirect to that url mentioned above.

  2. #2
    Join Date
    Feb 2013
    Posts
    6
    I can't find a edit button, so I'll just post again :s

    here's a better image to illustrate the desired output

    http://oi48.tinypic.com/564x4.jpg

  3. #3
    Join Date
    Mar 2009
    Location
    Wherever i lay my hat
    Posts
    180
    I know nothing about Wordpress, but that doesn't look like a code you should edit. I believe you are supposed to use some simpler API rather than modify their libraries.

    Seemingly, it generates some button and even a click handler for it, so if you delete all that "<button>" stuff, i don't know what you end up with. If you only need to redirect after clicking on that button, you could do something like:

    Code:
    base.prototype.pre_edit_button = function() {
          var _this = this;
          return jQuery('<button>', {
            'class': 'fee-hover-edit',
            'html': FrontEndEditor.data.edit_text,
            'click': function(ev) {
              location.href = "wp-admin/edit.php?post_type=page";
            }
          });
    but i still dicourage in doing so, as it seems you are modifying the library.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles